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

Sum add all the previous elements to a date

Hi, imagine there is a table with two column: Date and count code. (date show italian month)

  table.PNG

This is a table result from a graph. My query have all code in a date.

What i need is a table/graph that sum all previous code to a date; For example july 2017 (in the table "luglio 2017") will have the number of June 2017 + July 2017 (in table "giugno 2017"  + "luglio 2017") so 240+668= 908.
So something like that:
giugno 2017      |   240
luglio 2017        |   908
agosto 2017      |   908+220
settembre 2017 |  908+220+248


How can i do this?

1 ACCEPTED SOLUTION
anandav
Skilled Sharer
Skilled Sharer

@AlexEners,

You want a running total (cummulative total).

Check the link below how to do it,

https://whatthetechisthat.wordpress.com/2017/05/30/power-bi-cumulative-totals/

 

If your date field in below table is a date heirarchy, then you can choose only month and year. You need to have a calendar table and establish relatship with your data table.

 

 Running Toal Measure =

      CALCULATE(

          Sum(Table[Value],

          FILTER(All(Dim_Date[Date]), Dim_Date[Date] <= MAX(Dim_Date[Date]

          )

        )

View solution in original post

4 REPLIES 4
quentin_vigne
Solution Sage
Solution Sage

Hi @AlexEners

 

Here what I would do : 

1 - Create a new calculated colum to get your month name. 

 

MonthName = YourTable[DataInzoFornituraMese].[Mese]

 

(Not sure about the spelling as i'm trying to write this formula in italian)

 

2 - Use this month name + Sum of Conteggio di CodidePOD in a visual.

 

- Quentin

anandav
Skilled Sharer
Skilled Sharer

@AlexEners,

You want a running total (cummulative total).

Check the link below how to do it,

https://whatthetechisthat.wordpress.com/2017/05/30/power-bi-cumulative-totals/

 

If your date field in below table is a date heirarchy, then you can choose only month and year. You need to have a calendar table and establish relatship with your data table.

 

 Running Toal Measure =

      CALCULATE(

          Sum(Table[Value],

          FILTER(All(Dim_Date[Date]), Dim_Date[Date] <= MAX(Dim_Date[Date]

          )

        )

Can i do that with direct query?

@AlexEners,

Yes. You are able to calculate running total using anandav's DAX in DirectQuery mode. Ensure that  you turn on "allow unrestricted measures in directquery mode" option in your Power BI Desktop.

1.PNG


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.

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.