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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jalaomar
Helper IV
Helper IV

Filter a column based on another column

Hello,

 

This might be a simple solution and hopefully you can support me in this 

 

I have a table which i have sales values for projects and in the table I would like to filter out projects with a sales value below 600 only for Classification = L3

see below pic to demonstrate the input and output.

 

2022-02-25_12-43-27.png

2 ACCEPTED SOLUTIONS
Samarth_18
Community Champion
Community Champion

Hi @jalaomar 

 

Create a measure like below and use it as filter on your visual:-

 

_filter = if(sum(table[sales price])< 600,1,0)

 

Samarth_18_0-1645790204126.png

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

v-jingzhang
Community Support
Community Support

Hi @jalaomar 

 

Where do you want to see the expected output? If you want to filter out those rows from the data model, you can use Power Query editor to filter out those rows. Then only other rows will be imported into your model. 

 

Insert a custom step below existing steps in APPLIED STEPS pane and input below code into the formula bar. Replace "Changed Type" with the previous step name in your Power Query.  

= Table.SelectRows(#"Changed Type", each not ([Classification] = "L3" and [Sales Price] < 600))

vjingzhang_0-1646123408456.png

 

If you want to import all data rows but filter out those rows in a table visual in the report, you can create the following measure and use it as a filter on the table visual. Set the value is 1. 

Flag = IF(SELECTEDVALUE('Input Table'[Classification]) = "L3" && SUM('Input Table'[Sales Price]) < 600,0,1)

vjingzhang_1-1646123855796.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @jalaomar 

 

Where do you want to see the expected output? If you want to filter out those rows from the data model, you can use Power Query editor to filter out those rows. Then only other rows will be imported into your model. 

 

Insert a custom step below existing steps in APPLIED STEPS pane and input below code into the formula bar. Replace "Changed Type" with the previous step name in your Power Query.  

= Table.SelectRows(#"Changed Type", each not ([Classification] = "L3" and [Sales Price] < 600))

vjingzhang_0-1646123408456.png

 

If you want to import all data rows but filter out those rows in a table visual in the report, you can create the following measure and use it as a filter on the table visual. Set the value is 1. 

Flag = IF(SELECTEDVALUE('Input Table'[Classification]) = "L3" && SUM('Input Table'[Sales Price]) < 600,0,1)

vjingzhang_1-1646123855796.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hi @v-jingzhang , Thanks for the input.

 

I am struggling to count the total number of projects in a card visual based on the filter that I made in the table visual. How can I get the correct total number of projects for all visuals in the report. I could not use the measure in the card visual so that the right filter could be applied there as well.

 

BR

Samarth_18
Community Champion
Community Champion

Hi @jalaomar 

 

Create a measure like below and use it as filter on your visual:-

 

_filter = if(sum(table[sales price])< 600,1,0)

 

Samarth_18_0-1645790204126.png

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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