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
anu2021
Frequent Visitor

Need Help in getting the running total quick measure

Team, I am using running total from quick measures and not getting the desired output.. Given my dataset below, Headcount should be cumulative total of HTR column based on dates..

Data set:

HTRDATEHeadcount
H9/1/20192
H9/2/20193
H9/3/20194
H9/4/20195
H9/5/20196
H9/6/20197
H9/7/20198
H9/8/20199
H9/9/20191
M9/14/20193
T9/15/20192
M10/29/20292
M9/10/20191
M9/11/20192
M9/21/20192
T9/22/20192
T10/25/20292
T9/24/20192
T9/10/20192
T9/11/20192
H9/1/201930
M9/1/201920
T9/1/201940

 

Output am getting:  Only Total is getting computed correctly.. but the column values are not correct as is total value present in that particular date..

Output in powerbiOutput in powerbi

Desired Output: 

 

DateHMTGrand Total
9/1/201932204092
9/2/201935204095
9/3/201939204099
9/4/2019442040104
9/5/2019502040110
9/6/2019572040117
9/7/2019652040125
9/8/2019742040134
9/9/2019752040135
9/10/2019752142138
9/11/2019752344142
9/14/2019752644145
9/15/2019752646147
9/21/2019752846149
9/22/2019752848151
9/24/2019752850153
10/29/2029753050155
10/25/2029753052157

 

How to acheive this... Help needed!!!!!

1 ACCEPTED SOLUTION
Toerstad
Advocate I
Advocate I

Hi.

To achieve this you can create measures for the running totals and filter them by the different HTR categories. 

1. Create the three measures as described below

H = CALCULATE(
        SUM(Table[Headcount]),
        FILTER(ALL(Table[Date]),Table[Date] <= MAX(Table[Date])),Table[HTR]="H"
)

M = CALCULATE(
        SUM(Table[Headcount]),
        FILTER(ALL(Table[Date]),Table[Date] <= MAX(Table[Date])),Table[HTR]="M"
)

T = CALCULATE(
        SUM(Table[Headcount]),
        FILTER(ALL(Table[Date]),Table[Date] <= MAX(Table[Date])),Table[HTR]="T"
)

2. Create a matrix-visual and add the date fields to the rows area and the measures [H], [M], [T] and your [Grand Total]-measure to the values area for the visual.

You can find more information about cumulative totals here: https://www.daxpatterns.com/cumulative-total/

View solution in original post

1 REPLY 1
Toerstad
Advocate I
Advocate I

Hi.

To achieve this you can create measures for the running totals and filter them by the different HTR categories. 

1. Create the three measures as described below

H = CALCULATE(
        SUM(Table[Headcount]),
        FILTER(ALL(Table[Date]),Table[Date] <= MAX(Table[Date])),Table[HTR]="H"
)

M = CALCULATE(
        SUM(Table[Headcount]),
        FILTER(ALL(Table[Date]),Table[Date] <= MAX(Table[Date])),Table[HTR]="M"
)

T = CALCULATE(
        SUM(Table[Headcount]),
        FILTER(ALL(Table[Date]),Table[Date] <= MAX(Table[Date])),Table[HTR]="T"
)

2. Create a matrix-visual and add the date fields to the rows area and the measures [H], [M], [T] and your [Grand Total]-measure to the values area for the visual.

You can find more information about cumulative totals here: https://www.daxpatterns.com/cumulative-total/

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.