Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
nisuomi
Resolver I
Resolver I

DISTINCTCOUNT of groups with totals greater than 0

Hi,

 

I have a DAX problem, for some reason any of my DAX's are not working the way I need them to.

I need to calculate distinct amount of clients for account manager, which have sales over 0 - so any negative values are dropped out. And the time filtering should be working at least, and of course when selecting other filters as well. Am I thinking too complecated?

 

For some reson I can't this working..

 

measure = CALCULATE(DISTINCTCOUNT(Table1[asiakas]);FILTER(Table1;CALCULATE(sum(Table1[formula1]);ALLEXCEPT(Table1;Table1[client];Table1[month];Table1[year]))>0))

 

Capture.PNG

 

On the image, formula1 = peruslaskukaava, client = asiakas, month = kk, year = vuosi

The T1 is having the peruslaskukaava (formula1) inside it, it is just calculated on this measure.

 

 

Can't wrap my head around this. I get the amount for each customer as highlighted, but on the measure it shows the per row level sum distinctcount instead?

 

 

Cheers,
Niko

1 ACCEPTED SOLUTION
nisuomi
Resolver I
Resolver I

Have to say, that I might have found a solution already after using a Google.

 

From here: https://datamaul.wordpress.com/2017/11/19/distinct-count-of-dimension-based-on-a-filtered-measure/


Product Short of Target =
VAR ProductCount =
COUNTROWS ( FILTER ( VALUES ( 'Product'[ProductCode] ), [Fulfillment] < 1 ) )
RETURN IF ( ISBLANK ( ProductCount ), 0, ProductCount )

At least it seems to be working now the way it should.. Amazing!

If anybody else has some other solution, I am willing to listen and learn 🙂 But kudos to the datamaul!

 

 

 

Cheers,
Niko

 

View solution in original post

1 REPLY 1
nisuomi
Resolver I
Resolver I

Have to say, that I might have found a solution already after using a Google.

 

From here: https://datamaul.wordpress.com/2017/11/19/distinct-count-of-dimension-based-on-a-filtered-measure/


Product Short of Target =
VAR ProductCount =
COUNTROWS ( FILTER ( VALUES ( 'Product'[ProductCode] ), [Fulfillment] < 1 ) )
RETURN IF ( ISBLANK ( ProductCount ), 0, ProductCount )

At least it seems to be working now the way it should.. Amazing!

If anybody else has some other solution, I am willing to listen and learn 🙂 But kudos to the datamaul!

 

 

 

Cheers,
Niko

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.