Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi,
I need to be able to write a DAX logic which would give me the MTD sales on any given day. Below logic works like a charm
Solved! Go to Solution.
@mandar You could do something like this:
Sales =
VAR __Date = MAX('Date'[Date])
VAR __Result =
IF(DAY(__Date) = 1,
CALCULATE(SUM('Fact'[Sales]), PREVIOUSMONTH('Date'[Date])),
CALCULATE(SUM('Fact'[Sales]), DATESMTD('Date'[Date]))
)
RETURN
__Result
That said, the TI functions are slow.
@mandar You could do something like this:
Sales =
VAR __Date = MAX('Date'[Date])
VAR __Result =
IF(DAY(__Date) = 1,
CALCULATE(SUM('Fact'[Sales]), PREVIOUSMONTH('Date'[Date])),
CALCULATE(SUM('Fact'[Sales]), DATESMTD('Date'[Date]))
)
RETURN
__Result
That said, the TI functions are slow.
User | Count |
---|---|
84 | |
80 | |
72 | |
71 | |
55 |
User | Count |
---|---|
108 | |
106 | |
93 | |
84 | |
66 |