Dear all,
I have a table as following:
ID | Start date | End date |
A | 15-2-2018 | 15-6-2025 |
B | 1-1-2020 | 1-1-2024 |
C | 26-2-2021 | 31-12-2021 |
I would like to have a slicer on my report with a year and then show the selected IDs where the year is in (and in between) the start and end date. Example with results:
I filter 2019, this would only give me ID 'A' because that is the only ID where A is active.
I filter 2021, I returns all three, cause all three are taking place in this year.
Solved! Go to Solution.
@VV24 solution attached, you can tweak as per your need.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@VV24 here is the updated measure and in visual level filter change where a value greater than equal to 1
In the future, do create a separate post and do refer back to the original post, doesn't matter if it is an extension of existing question:
Filter Id =
VAR __result =
SUMX (
VALUES ( 'Table'[ID] ),
VAR __selectedYear = SELECTEDVALUE ( Years[Year], YEAR ( TODAY() ) )
VAR __minBuildDate = YEAR ( CALCULATE ( MIN ( 'Table'[Start date] ) ) )
VAR __maxBuildDate = YEAR ( CALCULATE ( MIN ( 'Table'[End date] ) ) )
RETURN
IF ( __selectedYear >= __minBuildDate && __selectedYear <= __maxBuildDate, 1, 0 )
)
RETURN __result
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k well it is actually the same dataset and case. with the following results in a cardvisual
I filter 2019, this would only give me ID 'A' because that is the only ID where A is active. so the count would be 1 (the result).
I filter 2021, I returns all three, cause all three are taking place in this year. which gives me 3 as a result.
2024 returns 2 and so on.
@VV24 solution attached, you can tweak as per your need.
Check my latest blog post Compare Budgeted Scenarios vs. Actuals I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k can you also make this work when you want to distinctcount the IDs in a card visual? you cant use the measure as a filter like in a table then.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!
User | Count |
---|---|
179 | |
67 | |
67 | |
57 | |
55 |
User | Count |
---|---|
188 | |
103 | |
89 | |
77 | |
72 |