March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I'm trying to do my best to filter on 2 sets of Years, but having a hard time with the dax. Not sure if this is a CALCULATE, or FILTER? Essentially, I want to have it so when the Year filter is 2022, it will filter for both YearID = 2022 & BudgetYear = 2022.
In the example below, when Year = 2022, only Project A & Project F should show.
when Year = 2021, Project C & Project D should show
when Year = 2020, nothing should show, etc
YearID | BudgetYear | Title |
2022 | 2022 | Project A |
2022 | 2021 | Project B |
2021 | 2021 | Project C |
2021 | 2021 | Project D |
2020 | 2021 | Project E |
2022 | 2022 | Project F |
2022 | 2023 | Project G |
Thanks!
Hi,
This is the approach you should follow. Create calculated column formulas to make 2 date columns (YearID_Date and BedgetYear_Date) from the Year columns you have (the date could be day 1 and month 1 of those years). Create a Calendar Table and write a calculated column formula to extract Year. Create a relationship (Many to One and Single) from the YearID_Date column to the Date column of the Calendar Table. Create a Table/matrix visual and drag Title there. Create a Year slicer from the Calendar Table and select 2022. Write this measure
Measure = calculate(countrows(Data),filter(Data,Data[YearID_date]=Data[BudgetYear_Date]))
Hope this helps.
HI @shinney,
It sounds like you want to achieve the custom filter effect.
For this scenario, I'd like to suggest you write a measure formula to compare current value and both two fields value and return flag. Then you can use this formula on visual level filter to filter records.
Applying a measure filter in Power BI - SQLBI
Using the SELECTEDVALUE function in DAX - SQLBI
Regards,
Xiaoxin Sheng
Hi Xiaoxin,
Thanks for the reply. I'm still not really understanding how SELECTEDVALUE here would apply. Also, what do you mean by the return flag? None of the DAX measures I've tried remotely works
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
115 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
167 | |
117 | |
63 | |
57 | |
50 |