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.
Dear Commnity,
I have a measure like this
Number of Requests
20.000
Date from until now (for example 01/01/2021 until 11/21/2022)
And I have a date slicer for the last 2 years and months. For example, if I select the month September from the year 2022 the year 2022 then I want that Date from should be replaced by the selected date.
My meausure should look like this
Number of requests
500
September 2022 until 11/21/2022.
How can I do this?
Thank you very much.
Solved! Go to Solution.
Hi @Learner22 ,
I created some data:
Here are the steps you can follow:
1. Create calculated table.
Table 2 =
CALENDAR(
DATE(2020,1,1),DATE(2022,12,31))
2. Create measure.
Measure =
var _selectyear=SELECTEDVALUE('Table 2'[Date].[Year])
var _selectmonth=SELECTEDVALUE('Table 2'[Date].[Month])
var _monthnumber=MAXX(FILTER(ALL('Table 2'),
FORMAT('Table 2'[Date],"mmmm")=_selectmonth),MONTH('Table 2'[Date]))
return
SUMX(FILTER(ALL('Table'),'Table'[Date]>=DATE(_selectyear,_monthnumber,1)&&'Table'[Date]<=TODAY()),[Value])
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi @Learner22 ,
I created some data:
Here are the steps you can follow:
1. Create calculated table.
Table 2 =
CALENDAR(
DATE(2020,1,1),DATE(2022,12,31))
2. Create measure.
Measure =
var _selectyear=SELECTEDVALUE('Table 2'[Date].[Year])
var _selectmonth=SELECTEDVALUE('Table 2'[Date].[Month])
var _monthnumber=MAXX(FILTER(ALL('Table 2'),
FORMAT('Table 2'[Date],"mmmm")=_selectmonth),MONTH('Table 2'[Date]))
return
SUMX(FILTER(ALL('Table'),'Table'[Date]>=DATE(_selectyear,_monthnumber,1)&&'Table'[Date]<=TODAY()),[Value])
3. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
yes, DATESBETWEEN function allows to pinpoint the start and end date of your calculation.
the start date in your case seems MAX(the column you put to slicer) and the end date you can put it TODAY().
Sorry, this doesn't work. If I select a specific month, the measure doesn't reflect that.
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 |
---|---|
49 | |
26 | |
21 | |
15 | |
12 |
User | Count |
---|---|
57 | |
49 | |
44 | |
19 | |
18 |