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.
Hi all,
I want to create a sum of weight for this year (till today) and compare it with a sum of weight for the exact same period last year.
I've created a New Measure as follow (-1;year doesn't work either and changing the order of year=2017 vs the date part doesn't do a thin either):
2017weight = CALCULATE(SUM('ds1'[Weight]);FILTER(ds1;'ds1'[levdat] < dateadd(ds1[today];-12;MONTH));('ds1'[year]=2017))
in the dateadd, [today] is a new measure containing (won't accept today() in a dateadd as everyone is familiar with):
today = today()
The above field 2017weight results in a 'Blank' field.
Why is that?
The following code does work, but it takes the whole month which I don't want.
2017weight = CALCULATE(SUM('ds1'[Weight]);('ds1'[year]=2017);ds1[month]<=month(today()))
Any thoughts?
Solved! Go to Solution.
Okay, seems lik I found a solution by coincidence (have to re-calculate the result, but seems okay).
2017weight = CALCULATE(SUM('ds1'[Weight]);('ds1'[year]=2017);('ds1'[levdat]<Date(year(now())-1;month(now());day(now()))))
really can't wrap my head around why this does work, and my previous attempt not.
What's the reason the dateadd won't work, as this dateadd function is explicit for this kind of calculation.
In my opinion my fix here is another way of writing what a dateadd function should do.
Okay, seems lik I found a solution by coincidence (have to re-calculate the result, but seems okay).
2017weight = CALCULATE(SUM('ds1'[Weight]);('ds1'[year]=2017);('ds1'[levdat]<Date(year(now())-1;month(now());day(now()))))
really can't wrap my head around why this does work, and my previous attempt not.
What's the reason the dateadd won't work, as this dateadd function is explicit for this kind of calculation.
In my opinion my fix here is another way of writing what a dateadd function should do.
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 |
---|---|
105 | |
96 | |
75 | |
63 | |
62 |
User | Count |
---|---|
135 | |
105 | |
104 | |
80 | |
65 |