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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
dcunningham27
Helper I
Helper I

Sum the number of distinct values (dates in this case) for each Store ID.

I want to sum the number of distinct values (dates in this case) for each Store ID.

Table
Store ID Date
101 October 1, 2018
101 May 1, 2017
102 October 1, 2018
102 May 2, 2017
103 October 1, 2018
103 May 3, 2017

So in this example, there are 2 distinct dates for each Store ID and 3 Stores. I want to display an output of “6” (using a card visual).

... and even a total of “6” at the bottom of the matrix if possible.

—————

What I did, which was not quite right was:
Calculation 1 = DISTINCTCOUNT(Table[Date])

Which gives me 4 - the distinct count of dates in that column but not by Store ID. That is not the output I want.

Can someone help me?
1 ACCEPTED SOLUTION
LivioLanzo
Solution Sage
Solution Sage

hey @dcunningham27

 

try this measure:

 

 

=
SUMX (
    VALUES ( Data[StoreID] ),
    CALCULATE (
        DISTINCTCOUNT ( Data[Date] )
    )
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

View solution in original post

2 REPLIES 2
LivioLanzo
Solution Sage
Solution Sage

hey @dcunningham27

 

try this measure:

 

 

=
SUMX (
    VALUES ( Data[StoreID] ),
    CALCULATE (
        DISTINCTCOUNT ( Data[Date] )
    )
)

 


 


Did I answer your question correctly? Mark my answer as a solution!


Proud to be a Datanaut!  

Thank you @LivioLanzo - this works! 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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