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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Migsmix
Frequent Visitor

Count & Distinctcount Dax Formula

Hi,

 

I need help with some visuals and DAX i'm trying to make. Currently i have a report in excel but now that has a lot of data it's hard to use. In the attached excel file you can see how my report works  File example . The PBI should look like the tab that says "Final in PBI". It has all the formulas. I was trying some Count Dax but it doesn't work. 

 

Thanks!!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Migsmix ,

Please refer to my pbix file to see if it helps you.

Create three measures.

distribution =
CALCULATE (
    COUNT ( Database[Code 2] ),
    FILTER (
        ALL ( Database ),
        Database[Cluster] = SELECTEDVALUE ( Database[Cluster] )
            && Database[Code 2] = SELECTEDVALUE ( Database[Code 2] )
            && Database[Brand] = SELECTEDVALUE ( Database[Brand] )
    )
)
number of stores =
CALCULATE (
    DISTINCTCOUNT ( Database[Store Name] ),
    FILTER (
        ALL ( Database ),
        Database[Cluster] = SELECTEDVALUE ( Database[Cluster] )
    )
)
mea % = [distribution]/[number of stores]

vpollymsft_0-1654566177111.png

 

Best Regards

Community Support Team _ Polly

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Migsmix ,

Please refer to my pbix file to see if it helps you.

Create three measures.

distribution =
CALCULATE (
    COUNT ( Database[Code 2] ),
    FILTER (
        ALL ( Database ),
        Database[Cluster] = SELECTEDVALUE ( Database[Cluster] )
            && Database[Code 2] = SELECTEDVALUE ( Database[Code 2] )
            && Database[Brand] = SELECTEDVALUE ( Database[Brand] )
    )
)
number of stores =
CALCULATE (
    DISTINCTCOUNT ( Database[Store Name] ),
    FILTER (
        ALL ( Database ),
        Database[Cluster] = SELECTEDVALUE ( Database[Cluster] )
    )
)
mea % = [distribution]/[number of stores]

vpollymsft_0-1654566177111.png

 

Best Regards

Community Support Team _ Polly

 

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

lbendlin
Super User
Super User

Thank you for providing the sample data. That helps a lot with proposing a potential solution.  However your expected result does not match your sample data.

 

Please show the expected result based on the sample data.  See attached for a starting point.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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 Solution Authors