Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
65 |
User | Count |
---|---|
136 | |
117 | |
101 | |
71 | |
61 |