Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 216485

DISTINCTCOUNT with FILTERS and ALL

$
0
0

Hi

I am really new to DAX & Power BI and I needed to do a running DISTINCTCOUNT of of the number of customers (Source No_) from a transaction table (Value Entry) with 2 FILTERS (Document Type = 2 && Sales > 0)

 

That was fairly easy as below;

 

Active Customers = calculate(DISTINCTCOUNT('TABLE$Value Entry'[Source No_]), FILTER(T_Date, T_Date[Date] <= max(T_Date[Date])), FILTER('TABLE$Value Entry',and('TABLE$Value Entry'[Document Type]=2, 'TABLE$Value Entry'[Sales Amount (Actual)] > 0)))

 

And to get total customers (for percentage of Active Customers calculation, with the same filters) i did;

 

Total Active Customers = calculate(DISTINCTCOUNT('TABLE$Value Entry'[Source No_]), FILTER(T_Date, T_Date[Date] <= max(T_Date[Date])),FILTER(ALL('TABLE$Value Entry'),and('TABLE$Value Entry'[Document Type]=2, 'TABLE$Value Entry'[Sales Amount (Actual)] > 0)))

 

Now this work fine as long as I am applying filters in Power BI Desktop from the same Table (Value Entry), like Business Category etc

 

But when I apply filters from another Table ('Customer'[Source No_]) like sales person code or current Location code it only gives me a percentage of the TOTAL customers not the customers for that sales person code ot Current Location code

 

PLEASE HELP


Viewing all articles
Browse latest Browse all 216485

Trending Articles