March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
I have a table holding 12 months of data. My date column is called [Reporting Period]
I have a value called [Total Cost] which is a simple interger.
I need to multiply [Total Cost] by 12, but I only need to multiply [Total Cost] for the most recent month, if I multiply it by all months it's a nonsensical figure.
How on earth do I do this?
Solved! Go to Solution.
I figured it out.
I created two measures. One determines the most recent [Total Cost] for the max date:
LATEST COST =
VAR MAXDATE =
MAX(Azure[Reporting Period])
RETURN
CALCULATE(SUM('Azure'[Cost]),
CALCULATETABLE(LASTDATE(SUMMARIZE('Azure','Azure'[Reporting Period])),
'Azure'[Reporting Period]<=MAXDATE))
The second measure simply multiplies this measure by 12. I could probably combine but I like the distiniction.
Burn Rate = [LATEST COST]*12
Hi @Anonymous ,
As you haven't provided a data sample, consider the data I have below. I have got Quantity data for 3 Months - Jan, Feb, Mar for 2019:
Now I created the following measure where the Quantity column will be multiplied by 12 only for the Maximum MONTH & YEAR value in this Date column which March 2019 in this case:
calcprice =
var maxmonth = CALCULATE(MONTH(MAX('Supermarket Sales'[Date])), ALL('Supermarket Sales'))
var maxYear = CALCULATE(YEAR(MAX('Supermarket Sales'[Date])), ALL('Supermarket Sales'))
RETURN
CALCULATE(
SUM('Supermarket Sales'[Quantity]) * 12,
FILTER(
'Supermarket Sales', MONTH('Supermarket Sales'[Date]) = maxmonth && YEAR('Supermarket Sales'[Date]) = maxYear
)
)
Now when I move calculated measure to my table visual, I see that only the Quantity value for March 2020 month-year is multiplied by 12 and for remaining months the measure shows empty as it is not multiplied by 12:
This calculation can also be modified to show original quantity for other months, but updated quantity (multiplied by 12) only for the latest month.
Also in my data Latest Month is MARCH, you may have DECEMBER at your end. But this calculation is dynamic to handle maximum month year in the data.
Let me know if this is what you were looking for.
Thanks,
Pragati
I figured it out.
I created two measures. One determines the most recent [Total Cost] for the max date:
LATEST COST =
VAR MAXDATE =
MAX(Azure[Reporting Period])
RETURN
CALCULATE(SUM('Azure'[Cost]),
CALCULATETABLE(LASTDATE(SUMMARIZE('Azure','Azure'[Reporting Period])),
'Azure'[Reporting Period]<=MAXDATE))
The second measure simply multiplies this measure by 12. I could probably combine but I like the distiniction.
Burn Rate = [LATEST COST]*12
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
90 | |
89 | |
85 | |
73 | |
49 |
User | Count |
---|---|
170 | |
145 | |
90 | |
67 | |
58 |