Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi Experts,
I have date slicer like this
When I select value from slicer I want to capture that date range. I want to use this date range as part of other measure filter.
For example I want date range 1/10/2022 to 6/12/2022 and not min and max dates.
I tried selected value function but it did not work.
Any pointers here?
Thanks in advance.
Regards,
Neha
Solved! Go to Solution.
Hi @nehajadhav166 ,
Since you did not give a specific table, I had to create my own table for testing according to your description, please point out if there are any problems.
Please try below steps:
1. below is my test table
Table:
Date Table(create from "Table" with dax):
Date Table = CALENDAR(FIRSTDATE('Table'[Date]),LASTDATE('Table'[Date]))
Model:
2. add a slicer with "Date Table[Date]",create a measure and add it to card visual
Sum for Sales =
VAR maxdate =
MAXX ( ALLSELECTED ( 'Date Table'[Date] ), [Date] )
VAR mindate =
MINX ( ALLSELECTED ( 'Date Table' ), [Date] )
VAR tmp =
CALENDAR ( mindate, maxdate )
RETURN
CALCULATE ( SUM ( 'Table'[Sales] ), tmp )
Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @nehajadhav166 ,
Since you did not give a specific table, I had to create my own table for testing according to your description, please point out if there are any problems.
Please try below steps:
1. below is my test table
Table:
Date Table(create from "Table" with dax):
Date Table = CALENDAR(FIRSTDATE('Table'[Date]),LASTDATE('Table'[Date]))
Model:
2. add a slicer with "Date Table[Date]",create a measure and add it to card visual
Sum for Sales =
VAR maxdate =
MAXX ( ALLSELECTED ( 'Date Table'[Date] ), [Date] )
VAR mindate =
MINX ( ALLSELECTED ( 'Date Table' ), [Date] )
VAR tmp =
CALENDAR ( mindate, maxdate )
RETURN
CALCULATE ( SUM ( 'Table'[Sales] ), tmp )
Please refer the attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous ,
Thank you for reply.
I tried this approch and it worked for me.
Hi Amit,
Thanks for quick reply.
I do not understand how countrows will help to get values selected from date slicer?
Can you please elaborate?
Thanks,
Neha
Measure =
var _tab = values(date[Date])
return
countrows(filter(Table, Table[Date] in _tab) )
Or between
new measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return
calculate( sum(Table[Value]), filter('Table', 'Table'[Date] >=_min && 'Table'[Date] <=_max))
User | Count |
---|---|
121 | |
76 | |
63 | |
51 | |
50 |
User | Count |
---|---|
175 | |
125 | |
60 | |
60 | |
58 |