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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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