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
Anonymous
Not applicable

Distinct count with filter for measure

Hi,

 

Applications measure counts distinct Transaction ID in the Fact table and AppAverageSchool calculates an average of distinct rows for a school.

Applications = 
    CALCULATE (  DISTINCTCOUNT(Transactions[Transaction ID])   )

AppAverageSchool = 
VAR ProgPerSch =
    CALCULATE (     DISTINCTCOUNT ( 'Dim Programs'[Program Code] ),
        ALLEXCEPT ( 'Dim Programs','Dim Programs'[School Name] )    )

VAR AppPerSch =
    CALCULATE ( [Applications], ALLEXCEPT ('Dim Programs','Dim Programs'[School Name] ) )
RETURN
    DIVIDE (AppPerSch, ProgPerSch, 99999 )

I want to filter out a program from the distinct count in var ProgramPerSchool when it is not present in the Fact table. Secondly, also want to remove a program when it has no application from AppAverageSchool measure calculation, as highlighted in yellow colour.

Project filter.PNG

Link for PBIX file and Excel File here

 

Thanks for the great support

2 ACCEPTED SOLUTIONS
dax
Community Support
Community Support

Hi DataPro, 

According to your description, it seems  that you wnat to remove highlight records, right? If I have something misundertsood, please correct me.

If so, you could try  to apply filter on measure Applications like below

305.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Anonymous
Not applicable

Hi @dax , yes Filters is one of the options but I am looking for a Dax query that can handle it.

Thanks,

View solution in original post

2 REPLIES 2
dax
Community Support
Community Support

Hi DataPro, 

According to your description, it seems  that you wnat to remove highlight records, right? If I have something misundertsood, please correct me.

If so, you could try  to apply filter on measure Applications like below

305.PNG

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Anonymous
Not applicable

Hi @dax , yes Filters is one of the options but I am looking for a Dax query that can handle it.

Thanks,

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.