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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Dave1mo1
Helper II
Helper II

Count Unique Dimension Based on Fact Table

Hi,

 

I'm trying to count the unique number of dealerships represented in the data for the current fiscal year of my fact table.

 

Relevant relationships:

 

FY Date Table [Date] -----> Activity Log Fact Table [Activity Date]

Dealership Lookup Table [Dealer ID] -----> Dealer Users Lookup [Dealer ID]

Dealer Users Lookup [User ID] -----> Activity Log Fact Table [User ID]

 

I've tried to utilize distinctcount, but any time I try to put a fiscal year filter on the visual, I get a "blank" value (see below). I'm not great with DAX, and this is frustrating!

 

Unique Dealership Logins = calculate(
    DISTINCTCOUNT(
        'Dealership Lookup Table' [Dealer ID]),
    filter(
        'Activity Log Fact Table', 'Activity Log Fact Table' [User ID]),
    USERELATIONSHIP(
        'FY Date Table'[Date], 'Activity Log Fact Table' [Activity Date])
    )
 
 
Thanks for any help you can offer.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dave1mo1 ,

Please update the formula of your measure [Unique Dealership Logins] as below and check if it can return the expected result...

 

Unique Dealership Logins =
VAR _tab =
    CALCULATETABLE (
        VALUES ( 'Activity Log Fact Table'[User ID] ),
        FILTER (
            'Activity Log Fact Table',
            'Activity Log Fact Table'[Activity Date]
                IN ALLSELECTED ( 'FY Date Table'[Date] )
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT('Dealership Lookup Table'[Dealer ID]),
        FILTER ( 'Dealer Users Lookup', 'Dealer Users Lookup'[User ID] IN _tab )
    )

 

If the above one can't help you figure out, please provide some raw data in above 4 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 link 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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Dave1mo1 ,

Please update the formula of your measure [Unique Dealership Logins] as below and check if it can return the expected result...

 

Unique Dealership Logins =
VAR _tab =
    CALCULATETABLE (
        VALUES ( 'Activity Log Fact Table'[User ID] ),
        FILTER (
            'Activity Log Fact Table',
            'Activity Log Fact Table'[Activity Date]
                IN ALLSELECTED ( 'FY Date Table'[Date] )
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT('Dealership Lookup Table'[Dealer ID]),
        FILTER ( 'Dealer Users Lookup', 'Dealer Users Lookup'[User ID] IN _tab )
    )

 

If the above one can't help you figure out, please provide some raw data in above 4 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 link 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

KNP
Super User
Super User

I'm not 100% sure without seeing your full model but you could try something like this...

 

dealer count = 
    COUNTROWS(
        SUMMARIZECOLUMNS(
            'Dealership Lookup Table' [Dealer ID], 
            "value", [A Measure From Your Fact Table]
        )
    )
Have I solved your problem?
Please click Accept as Solution so I don't keep coming back to this post, oh yeah, others may find it useful also ;).
chrome-9xf-Zagzel-B

If you found this post helpful, please give Kudos.
It gives me a sense of instant gratification and, if you give me Kudos enough times, magical unicorns will appear on your screen.
If you find my signature vaguely amusing, please give Kudos.
KIfp67uy-Sr
Proud to be a Super User!PBI-Super-User-Rank-30x30-1x
FreemanZ
Super User
Super User

hi @Dave1mo1 ,

 

Try like:

Measure =

COUNTROWS(

    SUMMARIZE(

        'Activity Log Fact Table',

        'Dealership Lookup Table' [Dealer ID]

     )

)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.