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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
vytautas1410
Frequent Visitor

Running Total with different periods

 

 

 


Hello , Everyone,
I need to create a measure of 3 product groups total sales and show it in chart and table.
Product Group A
Product Group B
Product Group C

 

 

The problem is that I need to represent those groups by different time period in the same month. (Runing total)

Group A (This Month)
Group B (Last 2 Months)
Group C (Last 3 Months)

 

For example I need to get a result showed in yellow background.  :

 

 

image.png

I can't figure how to count a correct total. I can only get expected correct results , but with incorrect total. (Using like 4 sub measures).

I would be very thankful if someone will help me.


1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

Here is one approach to do it:

 

Make a measure that uses switch to get your different calculations per group, and then a SUMX to get the right total.

 

Group Measure = SWITCH(SELECTEDVALUE(Table[Group]), "Group A", [Measure A], "Group B", [Measure B], "Group C", [Measure C], [Measure A])

 

Measure to use in Visual = SUMX(VALUES(Table[Group]), [Group Measure])

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

Here is one approach to do it:

 

Make a measure that uses switch to get your different calculations per group, and then a SUMX to get the right total.

 

Group Measure = SWITCH(SELECTEDVALUE(Table[Group]), "Group A", [Measure A], "Group B", [Measure B], "Group C", [Measure C], [Measure A])

 

Measure to use in Visual = SUMX(VALUES(Table[Group]), [Group Measure])

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.