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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
A_Scott
Helper I
Helper I

DISTINCTCOUNT with Multiple Filters Not Returning Correct Count

I am trying to count how many Division-Store have zero MEAT SAWS inpsections. Each store may have a different number of saws they are required to inspect once a day. My DAX calculation keeps returning the count of meat saws with zero inspections, not the count of stores.

Here is my DAX:

Stores with Zero Meat Saw Inspections = IF([Meat Saw Count]=0,"N/A",
    CALCULATE(
    DISTINCTCOUNT('Equip IDs'[Division-Store]),
    FILTER('Equip IDs','Equip IDs'[Equipment Product Type Descr]="MEAT SAWS"),
    FILTER('Equip IDs', [Completed Meat Saw Inspections] = 0)))
1 ACCEPTED SOLUTION

Hi @A_Scott ,

You can update the formula of measure [Stores with Zero Meat Saw Inspections] as below and check if it can return the expected result...

Stores with Zero Meat Saw Inspections =
IF (
    [Meat Saw Count] = 0,
    BLANK (),
    CALCULATE (
        DISTINCTCOUNT ( 'Equip IDs'[Division-Store] ),
        FILTER (
            'Equip IDs',
            'Equip IDs'[Equipment Product Type Descr] = "MEAT SAWS"
                && [Completed Meat Saw Inspections] = 0
        )
    )
)

If the above one can't help you get the expected result, please provide some raw data in the tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Community Support Team _ Rena
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
guggu74
New Member

Try this:

tores with Zero Meat Saw Inspections =
IF (
    [Meat Saw Count] = 0,
    "N/A",
    CALCULATE (
        DISTINCTCOUNT ( 'Equip IDs'[Division-Store] ),
        FILTER ( 'Equip IDs', 'Equip IDs'[Equipment Product Type Descr] = "MEAT SAWS" )
            && FILTER ( 'Equip IDs', [Completed Meat Saw Inspections] = 0 )
    )
)

I get an error...

A_Scott_0-1696420789557.png

 

Hi @A_Scott ,

You can update the formula of measure [Stores with Zero Meat Saw Inspections] as below and check if it can return the expected result...

Stores with Zero Meat Saw Inspections =
IF (
    [Meat Saw Count] = 0,
    BLANK (),
    CALCULATE (
        DISTINCTCOUNT ( 'Equip IDs'[Division-Store] ),
        FILTER (
            'Equip IDs',
            'Equip IDs'[Equipment Product Type Descr] = "MEAT SAWS"
                && [Completed Meat Saw Inspections] = 0
        )
    )
)

If the above one can't help you get the expected result, please provide some raw data in the tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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