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, there is a way to retrieve the filter dates given in POWER BI
I have to make the difference between the dates selected in the filter (those indicated by the red arrows) which obviously change according to the choice of those who use the report
Thanks
Marcello
Solved! Go to Solution.
Hello again
Total Days =
var min_ = min('Calendar'[Date])
var max_ = max('Calendar'[Date])
var days = DATEDIFF(min_,max_,DAY)
return
days
please analyse
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Hello,
My sugestion is to creat a measure:
Date_Dif =
var Min_ = min(date) //same field of slicer
var Max_ = max(date) //same field of slicer
var total_days = DATEDIFF(Min_ , Max_ , DAY) //https://docs.microsoft.com/pt-pt/dax/datediff-function-dax
return
total_days
Any question ask.
Best regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Ok, but I don't understand what I have to refer to date in this expression: var Min_ = min (date)
How do I refer to the filter date? Forgive me, maybe I'm missing something.
Thanks for the reply
Marcello
hello,
date is the same field that you use in the slicer.
any question ask
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Considering this example:
the cells in yellow are the ones where the date filter takes effect.
If I consider MIN ([Date]), the result is 07/03/2021, similarly, MAX ([Date]) the result is 25/07/2021.
What I need is the difference between 31/07/2021 and 01/03/2021: the difference between the dates indicated in the filter.
Forgive me ... maybe I'm wrong to explain
Thanks
Marcello
I try to explain myself better: the filter clearly refers to a field in a table.
Putting MIN([DataFilter]) returns the minimum Date value of that field ... not 01/03/2021 because, perhaps, there are no records of that date but subsequent
Hello again
My analysis :
Any questions
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Thanks for the answers and for the time you have dedicated me but I need the difference between 03/31/2021 and 01/01/2021 (the dates indicated in the "date filter" object regardless of the data in the table).
Marcello
Sorry, but I misinterpreted your question.
is this the correct scenario:
you need a calendar table to count the days and you must put in the slicer the date from the calendar table and not the date of the fact table
Any questions
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
I'm sorry but it doesn't work: it calculates the difference between all the days of the calendar table and not on the filter selection.
Thanks anyway
hello
by the previous example what would be the intended result?
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Hi Miguel,
Applying this filter:
only the records highlighted in yellow are considered in this table
the filter is associated with the Date field of the table above.
In the report structure there is also a TDate table where there are all the dates of the report (CALENDARAUTO ()) which is in JOIN with the Date field of the above table.
What I need is the difference between the filter dates, so in the example 7/31/2021 - 3/1/2021.
I hope I have explained myself better.
Thanks
Marcello
So for this example the result is 152 days?
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
Exactly
Thank you
Marcello
Hello again
Total Days =
var min_ = min('Calendar'[Date])
var max_ = max('Calendar'[Date])
var days = DATEDIFF(min_,max_,DAY)
return
days
please analyse
Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Best Regards
BC
Best regards
Bruno Costa | Super User
Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!!
Take a look at the blog: PBI Portugal
It works
Thanks Thanks thanks
Marcello
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 |
---|---|
115 | |
100 | |
88 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |