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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Ansari010
New Member

Distinct count showing same count for each date year

Hello All,

I have following tables and their relationship in a tabular model. In report, i have two slicers in report.

Slicer1 is on [D_Date].[DateYear]

Slicer2 is on [D_Member].[ProviderType]

 

i have to show year wise([D_Date].[DateYear]) distinct Member count using [D_AllMembers].[MemberID] but it is showing same count for each year. Can someone please guide me on how to get the desired result.

Many Thanks

Tables=>D_AllMembers D_Member F_Members D_Date
Fields=>MemberID MemberID MemberID DateKey
 MemberKey MemberKey DateYear  
 ProviderType DateKey    

 

F_Members(MemberKey)=>Many to One <=D_Member(MemberKey)
F_Members(MemberID)=>Many to One <=D_AllMembers(MemberID)
F_Members(DateKey)=>Many to One <=D_Date(DateKey)
1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Ansari010 ,

You can create a measure as below to get it:

Measure =
VAR _seldkeys =
    ALLSELECTED ( 'D_Date'[DateKey] )
VAR _selmkeys =
    ALLSELECTED ( 'D_Member'[MemberKey] )
VAR _fmids =
    CALCULATETABLE (
        VALUES ( 'F_Members'[MemberID] ),
        FILTER (
            'F_Members',
            'F_Members'[DateKey]
                IN _seldkeys
                    && 'F_Members'[MemberKey] IN _selmkeys
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'D_AllMembers'[MemberID] ),
        FILTER ( 'D_AllMembers', 'D_AllMembers' IN _fmids )
    )

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

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @Ansari010 ,

You can create a measure as below to get it:

Measure =
VAR _seldkeys =
    ALLSELECTED ( 'D_Date'[DateKey] )
VAR _selmkeys =
    ALLSELECTED ( 'D_Member'[MemberKey] )
VAR _fmids =
    CALCULATETABLE (
        VALUES ( 'F_Members'[MemberID] ),
        FILTER (
            'F_Members',
            'F_Members'[DateKey]
                IN _seldkeys
                    && 'F_Members'[MemberKey] IN _selmkeys
        )
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'D_AllMembers'[MemberID] ),
        FILTER ( 'D_AllMembers', 'D_AllMembers' IN _fmids )
    )

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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