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
WOLFIE
Helper I
Helper I

Cumulative total not working with distinct count on text

Hi all,

Could you please help with the below? I used this technique many times with integers,which worked fine, but it doesn't work when doing distinct count on text. I need to get cumulative total of customers for 3 different date columns. Sales table data is in the comment below.

Data model:

WOLFIE_1-1634293109305.png

Cumulative total_customer count (sofa sales) =
VAR Customer_count =
CALCULATE(DISTINCTCOUNT('Sales'[Customer ID])
,USERELATIONSHIP('Calendar'[Date],'Sales'[Sofa sales date]))
VAR MaxDate = MAX ( 'Calendar'[Date] ) -- Saves the last visible date
RETURN
CALCULATE (
Customer_count,
'Calendar'[Date] <= MaxDate, -- Where date is before the last visible date
ALL('Calendar'[Date]) -- Removes any other filters from Date
)

I need to create identical measures for all 3 date columns, therefore using the inactive relationships. 

WOLFIE_2-1634293287577.png

 
1 ACCEPTED SOLUTION
WOLFIE
Helper I
Helper I

WOLFIE_0-1634298304922.png

I worked it out! 😄 

View solution in original post

2 REPLIES 2
WOLFIE
Helper I
Helper I

WOLFIE_0-1634298304922.png

I worked it out! 😄 

WOLFIE
Helper I
Helper I

data:

Customer ID

Sofa sales

TV salesChair sales
101/01/202102/03/202106/03/2021
230/12/202014/03/202116/04/2021
316/12/202001/01/202116/05/2021
403/02/202115/06/2021 
526/02/2021  
613/12/202018/02/2021 
716/01/202124/02/202130/03/2021
802/04/202128/05/2021 
903/01/202126/01/2021 
1026/04/2021  
1118/02/202128/05/2021 
1213/12/2020  
1326/02/202128/05/202103/06/2021
1428/05/202115/06/2021 
1513/12/2020  
1618/02/202114/03/202120/05/2021
1713/12/2020  
1813/12/202015/06/2021 
1915/06/2021  
2013/12/2020  
2116/12/202014/03/2021 
2215/06/2021  
2313/12/2020  

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.