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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Swich between filters dependent on data

Hi

 

Can i one of two filters based on code?

Say like if the colour is orange filter by orange table column values but if green then use anoth filter completely?

 

Any help much appretiated

 

Andy

1 ACCEPTED SOLUTION

Hi @Anonymous ,

Try something like this as per your requirement and data:

Measure= IF(SELECTEDVALUE(TABLE(VALUE))=1, CALCULATE (SUM(Column), filter expression1), CALCULATE (SUM(Column), filter expression2

))

 

Mark this as a solution if I answered your question. Kudos are always appreciated.

Thanks

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi

OK, wasn't very explicit, sorry. If you have a tabular model dataset that has 2 tables in it that can be used for filtering, each with its own data that joins to a different column, in a paginated report I need to create DAX queries that will use one or other of the 2 tables, but not both. The 2 don't form a hierarchy, so I can't use it that way. Filtering will be driven by a combination of data and user selection of parameters. This can be achieved fairy easily in SQL, but I need to do it in DAX, it would be sort of like an if value = 1 then use 1 filter if not use the other, which I have tried in DAX and it just errors with a syntax error, in SQL I would use a case statement in the where clause, but I don't know how to do the same in DAX

 

Any help, much appreciated 

 

Regards

 

Andy  

Hi @Anonymous ,

Try something like this as per your requirement and data:

Measure= IF(SELECTEDVALUE(TABLE(VALUE))=1, CALCULATE (SUM(Column), filter expression1), CALCULATE (SUM(Column), filter expression2

))

 

Mark this as a solution if I answered your question. Kudos are always appreciated.

Thanks

Tanushree_Kapse
Impactful Individual
Impactful Individual

Hi @Anonymous ,

 

Yes, you can use two filters.

But I didn't quite understand your question.

Can you please give us an example.

 

Thanks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.