Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
WillemvB
Frequent Visitor

Using two measures to filter table

Hi

Being new to DAX, I am stuck and would appreciate some help. My data table has many columns of which one is the Financial Year. I would like the user to select any financial year in a slicer and would then display the data for the selected year as well as the previous year. I made two measures, SelectedFY and PreviousFY. I wanted to use these measures to filter the data, but it only works when I hardcode the variables.

So this works:

TableFILTER =
VAR SFY = "FY22"
VAR PFY = "FY21"
VAR FilteredData = FILTER(ALL(DataAll),DataAll[TheFinYear]=SFY || DataAll[TheFinYear]=PFY)
RETURN
FilteredData
But if I change the variables to equal the measures, the table filter returns nothing:
VAR SFY = [SelectedFY]
VAR PFY = [PreviousFY]
 
1 ACCEPTED SOLUTION
Manoj_Nair
Solution Supplier
Solution Supplier

@WillemvB - try this solution and let me know if this resolve your problem. attached pbix file 

image.jpg

If my post helps you to find solution would be happy if you could mark my post as a solution and give it a thumbs up

 

Best regards

Manoj Nair

Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

View solution in original post

2 REPLIES 2
WillemvB
Frequent Visitor

Thank you, Manoj. This solution helps me.

Manoj_Nair
Solution Supplier
Solution Supplier

@WillemvB - try this solution and let me know if this resolve your problem. attached pbix file 

image.jpg

If my post helps you to find solution would be happy if you could mark my post as a solution and give it a thumbs up

 

Best regards

Manoj Nair

Linkedin - https://www.linkedin.com/in/manoj-nair-%E2%98%81-344666104/

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.