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
scott01
Regular Visitor

Cumulative Total for Historical Weeks Only

Hi,

 

I have calculated a running total measure that measures the number of accounts that have converted by each week since registration. This measure calculates over a user-defined window registration period and ensures that all accounts have had the same length of time to convert.

 

However, I'd like to be able to have the running total measure calculate only up until the maximum_weeks_to_convert value, in this case where weeks_to_convert = 7, in order to prevent the horizontal line at the end of the cumulative total.

 

Please can you assist in helping me to remove the values from the red highlighted areas?

 

Thanks

 

PowerBI Cumulative Total.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Running Total = 
var latest_week = MAX(ConversionData[current_week])
var latest_selected_week = CALCULATE(MAX(WeekList[business_week]),ALLSELECTED(WeekList[business_week]))
RETURN
var maximum_weeks_to_convert = latest_week - latest_selected_week
RETURN
CALCULATE(SUM(ConversionData[CY]),FILTER(ALLSELECTED(ConversionData),ConversionData[weeks_to_convert] <= maximum_weeks_to_convert && ConversionData[weeks_to_convert] <= MAX(ConversionData[weeks_to_convert])))

 

Sample dashboard:

Sample Conversion Example

 

 

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@scott01,

Change your DAX to the following:

Running Total = 
var latest_week = MAX(ConversionData[current_week])
var latest_selected_week = CALCULATE(MAX(WeekList[business_week]),ALLSELECTED(WeekList[business_week]))
RETURN
var minimum_weeks_to_convert = latest_week - latest_selected_week
RETURN
IF(ISBLANK([CY_full_opp_verbose]),BLANK(),CALCULATE(SUM(ConversionData[CY]),FILTER(ALLSELECTED(ConversionData),ConversionData[weeks_to_convert] <= minimum_weeks_to_convert && ConversionData[weeks_to_convert] <= MAX(ConversionData[weeks_to_convert]))))


Please check details in the PBIX file.
https://1drv.ms/u/s!AhsotbnGu1Nok1_mKj_sx7X_VqDF

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

3 REPLIES 3
FlaF
Helper I
Helper I

You can filter your graph and your table in report - "visualizations": click on fields--> filters: "weeks_to_convert" is less than 8

 

ciao

v-yuezhe-msft
Employee
Employee

@scott01,

Change your DAX to the following:

Running Total = 
var latest_week = MAX(ConversionData[current_week])
var latest_selected_week = CALCULATE(MAX(WeekList[business_week]),ALLSELECTED(WeekList[business_week]))
RETURN
var minimum_weeks_to_convert = latest_week - latest_selected_week
RETURN
IF(ISBLANK([CY_full_opp_verbose]),BLANK(),CALCULATE(SUM(ConversionData[CY]),FILTER(ALLSELECTED(ConversionData),ConversionData[weeks_to_convert] <= minimum_weeks_to_convert && ConversionData[weeks_to_convert] <= MAX(ConversionData[weeks_to_convert]))))


Please check details in the PBIX file.
https://1drv.ms/u/s!AhsotbnGu1Nok1_mKj_sx7X_VqDF

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yuezhe-msft Thanks. That works perfectly.

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.