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, I just need a simple measure to count the number of days on a slicer filter.
If the start date on a slicer is 7/13/2020 and the end date 7/15/2020, I would like the measure to return a value of 2.
If the start date on a slicer is 7/13/2020 and the end date 7/17/2020, I would like the measure to return a value of 4.
If the start date on a slicer is 7/13/2020 and the end date 7/23/2020, I would like the measure to return a value of 10.
Any ideas on how to do this?
Solved! Go to Solution.
Hi @pal95 ,
You could create a table like below
slicer = CALENDAR(date(2020,1,1), date(2020,12,31))
Then use this in slicer and create measure like below
Measure = DATEDIFF( MIN(slicer[Date]),MAX(slicer[Date]),DAY)
You could refer to my sample for details.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @pal95 ,
Try this
measure =
VAR maxselval =
MAXX (
ALLSELECTED ( Date ),
Date[Date]
)
VAR minselval =
MINX (
ALLSELECTED ( Date ),
Date[Date]
)
RETURN
DATEDIFF (
maxselval,
minselval,
DAY
)
Regards,
Harsh Nathani
Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!
What should I put in Date[Date]? I would like to use the value on the slicer, so here, I would like to have a measure value of 11.
Hi @pal95 ,
You could create a table like below
slicer = CALENDAR(date(2020,1,1), date(2020,12,31))
Then use this in slicer and create measure like below
Measure = DATEDIFF( MIN(slicer[Date]),MAX(slicer[Date]),DAY)
You could refer to my sample for details.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@pal95 , try like
measure =
var _max = maxx(allselected(Date),Date[Date])
var _min = minx(allselected(Date),Date[Date])
return datediff(_min,_max,Day)
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 |
---|---|
113 | |
99 | |
75 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |