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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
atziovara
Helper I
Helper I

Filters based on IDs

I have a table called 'TableBI' which stores the answers of multiple companies to multiple questions. It looks like this:

 

Company IDQuestionAnswer
1Current Demand0.3
1Future Demand0.2
1Current Labor0.4
1Future Labor0.5
2Current Demand0.5
2Future Demand0.4
2Current Labor0.3
2Future Labor0.2
3Current Demand0.3
3Future Demand0.3
3Current Labor0.6
3Future Labor0.7


I need to perform some calculations with the answers based on specific criteria. One of these criteria is that the Future Demand of the companies needs to be > 0.2.

Therefore, I would like to create either a new filtered table or a new column that will include ALL the Answers of ONLY the companies for which when [Question] = Future Demand, [Answer] > 0.2.

It should look like this:

Company IDQuestionAnswerFiltered Answer
1Current Demand0.3 
1Future Demand0.2 
1Current Labor0.4 
1Future Labor0.5 
2Current Demand0.50.5
2Future Demand0.40.4
2Current Labor0.30.3
2Future Labor0.20.2
3Current Demand0.30.3
3Future Demand0.30.3
3Current Labor0.60.6
3Future Labor0.70.7


This is very important, so thank you very much in advance!

1 ACCEPTED SOLUTION

Hi, @atziovara 

Thank you very much for your reply. I have re-edited my DAX expression below:

AnswerFiltered =
VAR _table =
    SUMMARIZE (
        FILTER ( 'Table', 'Table'[Question] = "Future Demand" && 'Table'[Answer] > 0.2 ),
        'Table'[Company ID]
    )
RETURN
    IF ( 'Table'[Company ID] IN _table, 'Table'[Answer] )

The results are as follows:

hackcrr_0-1715348602841.png

 

Best Regards,

hackcrr

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
hackcrr
Super User
Super User

Hi, @atziovara 

You can try the following DAX expressions:

AnswerFiltered = 
IF('Table'[Question]="Future Demand"&&'Table'[Answer]>0.2,'Table'[Answer])

This will filter out all answers with [Question] = Future Demand, [Answer] > 0.2. The results are as follows:

hackcrr_0-1715344825981.png

 

 

Best Regards,

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@hackcrr Thank you for your answer!

I am afraid that your response does not resolve my issue. As stated above, I would like my new column to include all answers of companies for which when [Question] = Future Demand, [Answer] > 0.2. Not just the answers to Future Demand where the value is > 0.2

It should look like this:

CompanyID Question Answer FilteredAnswer
1Current Demand0.3 
1Future Demand0.2 
1Current Labor0.4 
1Future Labor0.5 
2Current Demand0.50.5
2Future Demand0.40.4
2Current Labor0.30.3
2Future Labor0.20.2
3Current Demand0.30.3
3Future Demand0.30.3
3Current Labor0.60.6
3Future Labor0.70.7

Hi, @atziovara 

Thank you very much for your reply. I'm a little confused as to why the
CompanyID=1 is empty for the corresponding FilteredAnswer column?

 

Best Regards,

hackcrr

@hackcrr The data for the company whose ID = 1 are empty, because I would like to perform calculations for all the other companies that fit the criteria. I want to filter out companies based on the criteria related to Future Demand and then perform calculations with the answers of the remaining companies.

Hi, @atziovara 

Thank you very much for your reply. I have re-edited my DAX expression below:

AnswerFiltered =
VAR _table =
    SUMMARIZE (
        FILTER ( 'Table', 'Table'[Question] = "Future Demand" && 'Table'[Answer] > 0.2 ),
        'Table'[Company ID]
    )
RETURN
    IF ( 'Table'[Company ID] IN _table, 'Table'[Answer] )

The results are as follows:

hackcrr_0-1715348602841.png

 

Best Regards,

hackcrr

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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