Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey!
I finally managed to compare current month with previous month values, with a "YYYYMM" field
Test =
VAR CurrYM =
MAX(Date[YearMonth])
VAR prevDate =
DATE(LEFT(CurrYM, 4), RIGHT( CurrYM, 2) -1, 1)
VAR prevYM =
YEAR(prevDate) *100
+ MONTH(prevDate)
RETURN
CALCULATE(
[# Customers],
FILTER(ALLSELECTED(Date), Date[YearMonth] = prevYM)
)
The result however is that, when I want to only see current Year results (Customer differences between months). It shows that January has gained the total amount of customers. Cause there is no december, it probably thinks the previous month must be 0?
This makes working with this measure unusable, since it makes the other months look tiny. Is there any way to make January look at the december results, despite me only wanting to see current year results? If I were to add last year results, the issue would move to january last year.
I'd love to hear what my options are :)!
Kind regards,
Daniël
You're doing it all wrong.
When working with dates, you should never work with text and do stunts in the code like
DATE(LEFT(CurrYM, 4), RIGHT( CurrYM, 2) -1, 1)
It's not only ugly. It's error-prone. As you've seen.
Instead, you should work with real numbers/dates and, if possible, with the in-built time-intel functions. Please go to this vid and learn how to deal with date calculations:
(2) Time Intelligence calculations with Power BI | Community Webinars - YouTube
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
111 | |
100 | |
80 | |
64 | |
58 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |