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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Raul
Post Patron
Post Patron

Running total

Hello everybody,

I have a CALENDAR table in my data model. I have too two more tables: WAREHOUSES and TARGETS:

IDWAREHOUSE
AWarehouse1
BWarehouse2
CWarehouse3

 

YEARWAREHOUSETARGET
2017A $    5.000,00
2017B $ 10.000,00
2017C $ 20.000,00
2016A $    6.000,00
2016B $ 25.000,00
2016C $ 18.000,00

 

The TARGETS table is not related with de CALENDAR table but is related with the WAREHOUSES table. I have too a measure MonthTarget = SUM(Target)/12

 

I need the running total for Target field in this matrix visualization:

 

YEAR2017
WAREHOUSEA
MonthTarget
January $       416,67
February $       833,34
March $    1.250,00

  

The YEAR and WAREHOUSE fields are filters and the value of 416,67 is the MonthTarget value of the A warehouse for the year 2017. For a whole year it would be:

YEAR2017
WAREHOUSEA
  
MonthTarget
January $       416,67
February $       833,34
March $    1.250,00
--- $    1.666,67
--- $    2.083,34
--- $    2.500,00
--- $    2.916,67
--- $    3.333,34
--- $    3.750,00
--- $    4.166,67
--- $    4.583,34
December $    5.000,00

 

How can I calculate this measure?

Thank you.

 

 

 

1 ACCEPTED SOLUTION

In looking at your data layout and calculation, I would create a MONTH column in your Calendar table and do something like:

 

Measure = MonthTarget * AVERAGE(Calendar[Month])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

Have you tried the Running Total quick measure?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Yes, but the result is the same value of the month target for every mont, like this:

MonthTargetRunningTotal
January $       416,67 $       416,67
February $       833,34 $       416,67
March $    1.250,00 $       416,67

 

Can you post that formula?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

RunningTotal =
CALCULATE(
[MonthTarget];
FILTER(
ALLSELECTED('Calendar'[Month]);
ISONORAFTER('Calendar'[Month]; MAX('Calendar'[Month]); DESC)
)
)

In looking at your data layout and calculation, I would create a MONTH column in your Calendar table and do something like:

 

Measure = MonthTarget * AVERAGE(Calendar[Month])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Great!!! It works perfectly.

Thank you very much @Greg_Deckler

Happy to help! 🙂



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.