The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi Team,
I have been working on a report where I want to display the cumulative total of last 3 months along with the previous months added values
Solved! Go to Solution.
@pradeepnani Try using
VAR LastSDate = MAX('CALENDAR'[Date])
VAR Last3Months = DATESINPERIOD('CALENDAR'[Date], LastSDate, -3, MONTH)
VAR Last3MonthsSum = CALCULATE(SUM(Orders[Freight]), Last3Months)
VAR Month1 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], LastSDate, -1, MONTH))
VAR Month2 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -1), -1, MONTH))
VAR Month3 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -2), -1, MONTH))
RETURN IF(
ISBLANK(SELECTEDVALUE('CALENDAR'[MONTH_YEAR])),
0,
FORMAT(Last3MonthsSum, "#,##0") & " (" & FORMAT(Month1, "#,##0") & ") + (" & FORMAT(Month2, "#,##0") & ") + (" & FORMAT(Month3, "#,##0") & ")"
)
Proud to be a Super User! |
|
@pradeepnani Try using
VAR LastSDate = MAX('CALENDAR'[Date])
VAR Last3Months = DATESINPERIOD('CALENDAR'[Date], LastSDate, -3, MONTH)
VAR Last3MonthsSum = CALCULATE(SUM(Orders[Freight]), Last3Months)
VAR Month1 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], LastSDate, -1, MONTH))
VAR Month2 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -1), -1, MONTH))
VAR Month3 = CALCULATE(SUM(Orders[Freight]), DATESINPERIOD('CALENDAR'[Date], EDATE(LastSDate, -2), -1, MONTH))
RETURN IF(
ISBLANK(SELECTEDVALUE('CALENDAR'[MONTH_YEAR])),
0,
FORMAT(Last3MonthsSum, "#,##0") & " (" & FORMAT(Month1, "#,##0") & ") + (" & FORMAT(Month2, "#,##0") & ") + (" & FORMAT(Month3, "#,##0") & ")"
)
Proud to be a Super User! |
|
@pradeepnani ,It would be better if instead of snap you share code with which we can work.
Proud to be a Super User! |
|
User | Count |
---|---|
17 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
26 | |
13 | |
12 | |
9 | |
8 |