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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
meirlicht
Frequent Visitor

DAX ALL() not working

I am trying to filter out items that only have 1 unit price.
I created the following measure which is supposed to return the number of distinct unit prices, ignoring table filters.
Distinct Count of Price 2.0CALCULATE(DISTINCTCOUNT(SalesData[Unit Price]),ALL(SalesData[Year], SalesData[Month], SalesData[Unit Price]))
The issue is, as you can see in the followig screenshot, the measure is still impacted by the Month filter and returning a different Distinct Count of Price 2.0 for different months.
meirlicht_0-1706115769665.png

 

 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @meirlicht ,

You can optimize your Dax performance with this code:

 

Distinct Count of Price 2.0 = 
CALCULATE (
    COUNTROWS ( DISTINCT ( 'SalesData'[Unit Price] ) ),
    ALLEXCEPT ( 'SalesData', 'SalesData'[Code], 'SalesData'[Store] )
)

 

 

Final output:

vyifanwmsft_0-1706777508628.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

3 REPLIES 3
Anonymous
Not applicable

Hi @meirlicht ,

Based on the information you provided, you can follow these steps:

1. Change your measure.

Distinct Count of Price 2.0 = 
COUNTAX (
    FILTER (
        ALL ( 'SalesData' ),
        'SalesData'[Code] = SELECTEDVALUE ( SalesData[Code] )
    ),
    'SalesData'[Unit Price]
)

 

Final output:

vyifanwmsft_0-1706149646889.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Hello Ada, the issue with the measure you provided is it returns count rather than distinct count, but it helped guide me on the right path to the following measure. (I also included the store filter in the measure)

 

Distinct Count of Price 2.0 = 
CALCULATE (
    DISTINCTCOUNT ( 'SalesData'[Unit Price] ),
    FILTER (
        ALL ( 'SalesData' ),
        'SalesData'[Code] = SELECTEDVALUE ( SalesData[Code] )
            && 'SalesData'[Store] = SELECTEDVALUE ( SalesData[Store] )
    )
)

 

Is there a more efficient way to do this? It is taking a long time to load in my matrix.

Thank you so much for your time!

Anonymous
Not applicable

Hi @meirlicht ,

You can optimize your Dax performance with this code:

 

Distinct Count of Price 2.0 = 
CALCULATE (
    COUNTROWS ( DISTINCT ( 'SalesData'[Unit Price] ) ),
    ALLEXCEPT ( 'SalesData', 'SalesData'[Code], 'SalesData'[Store] )
)

 

 

Final output:

vyifanwmsft_0-1706777508628.png

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

If it does not help, please provide more details with your desired out put and pbix file without privacy information.

 

Best Regards,

Ada Wang

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

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors