The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
In this topic:
https://carldesouza.com/total-month-to-date-totalmtd-totalqtd-totalytd-datesmtd-power-bi/
There is a description of how this measure:
MTD = TOTALMTD(SUM(Orders[Amount]), Dates[Date], FILTER(Dates, Dates[Date] < TODAY()))
Can be used to have the previous months showing the full amounts, and the current month showing the MTD up to yesterday, as per this screenshot:
The challenge I have is to calculate the proper monthly $ variances from such a table. For all the complete months, this is basically using [MTD]-[PMTD]. However, for the current month, the calculation should compare the MTD up to yesterday, with the PMTD of the same day, a month ago, to see how much we increased vs. the same day last month, eg on the same period. And the results should all be in the same column, in order to create the proper visuals.
Tried many measures to achieve this but having no luck so far. Any ideas?
Thanks in advance for your help!
Erik
Solved! Go to Solution.
Thanks for the suggestions. After reviewing them and reading many more posts, the following solution worked:
Step 1. In the Transactions table, added this calculated column:
Step 2. Created a measure using the "Values" function, which uses the step 1 column as a condition, in order to "assign" one of the two measures: MoM for completed months, and MTD for the current month.
Thanks for the suggestions. After reviewing them and reading many more posts, the following solution worked:
Step 1. In the Transactions table, added this calculated column:
Step 2. Created a measure using the "Values" function, which uses the step 1 column as a condition, in order to "assign" one of the two measures: MoM for completed months, and MTD for the current month.
MTD :=
calculate(
[Total Amount],
Dates[Date] < TODAY(),
DATESMTD( Dates[Date] )
)
PYMTD :=
var __effectiveDates =
CALCULATETABLE(
VALUES( Dates[Date] ),
KEEPFILTERS( Dates[Date] < TODAY() )
)
return
calculate(
[MTD],
SAMEPERIODLASTYEAR( __effectiveDates )
)
Best
D
Time intelligence functions are really just syntax sugar for FILTER. If you want explicit control over your date filters, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
28 | |
13 | |
12 | |
12 | |
6 |