The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
We want to calculate the difference in seconds between the two dates( start and end) selected from a slicer. As we are very new to this could anyone please help us out?
Thank you,
Nikhil Pranav
Solved! Go to Solution.
Hi @nikhil893,
PorkChop's DAX expression works fine.
Measure = DATEDIFF(MIN(Sales[Date]),MAX(Sales[Date]),DAY)&" Days"
Regards,
Charlie Liao
Hey dude.
If you are doing this in dax it's super simple.
=DATEDIFF([Startdate],[EndDate],second)
@PorkChop : We need to have the start and end dates to be selected from the user using a slicer. Will this measure work for that too ? We do not have any columns named ' Start date' and 'end date'. We have only one column as date which we are using in a slicer.
Hi @nikhil893,
PorkChop's DAX expression works fine.
Measure = DATEDIFF(MIN(Sales[Date]),MAX(Sales[Date]),DAY)&" Days"
Regards,
Charlie Liao
*flexes*
Interesting, maybe you could try
=DATEDIFF(min([DATE]),max([DATE]),second)
where [DATE] is the columnname of the slicer you are using?
@PorkChop : The DATE coulmn may have dates from 1 Nov 2016 till 30 Nov 2016. The selection from the slicer could be 2 Nov (start date) and 4 Nov (End date). We need these two dates ( 2 Nov and 4 Nov) , not the min and max dates in the date column. Will this measure work for that ?
Well i've not tested it i practice but it should do. When you are filtering using the slicer, it's actually like creating a new table of entries between those two dates. If we then pick the smallest and largest values in that table it's the same effect.
You'll want to test it, as I haven't but syntactically should be correct.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
108 | |
78 | |
77 | |
46 | |
39 |
User | Count |
---|---|
137 | |
108 | |
64 | |
64 | |
53 |