cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
VV24
Helper III
Helper III

Active year slicer within start and enddate

Dear all,

I have a table as following:

IDStart dateEnd date
A15-2-201815-6-2025
B1-1-20201-1-2024
C26-2-202131-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.

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@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.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@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.

 

 






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





parry2k
Super User
Super User

@VV24 not fully sure what you are looking for, maybe open another post and refer back to this so that these stay as a separate solution.






Did I answer your question? Mark my post as a solution.

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.

parry2k
Super User
Super User

@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.






Did I answer your question? Mark my post as a solution.

Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.





@parry2k  awesome! thank you very much!

@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.

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors
Top Kudoed Authors