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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
PowerrrBrrr
Helper III
Helper III

how to filter a column in measure based on other column

So I have two table - Table A and Table B. they have one to many relationship

Table A 

IDClassName
202212LATSome random name
202214LATSome random name
202111LANSome random name
202122LANSome random name

 

and Table 2

IDtimestamp       value1      value2
202212    2021-09-12 23:22:11       12.4        43
202212    2021-12-11 12:12:23       28.6        54
202111     2021-09-01 03:23:22       32.7        76
2021112021-07-07 12:12:09       32.8        77


So I would like a measure where I get all Average value for each ID of Class "LAT". how can i do it in a measure??

1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @PowerrrBrrr 

 

Try to create a measure like this:

ave = 
var _t=FILTER(ALL(TableA),'TableA'[Class] in {"LAT"})
var _ID_list=SUMMARIZE(_t,[ID])
var _if=IF(ISINSCOPE(TableB[ID]),IF(MAX('TableB'[ID])in _ID_list,DIVIDE(SUM(TableB[value1])+SUM(TableB[value2]),2)))
return _if

 Result:

vangzhengmsft_0-1634177131691.png

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

3 REPLIES 3
v-angzheng-msft
Community Support
Community Support

Hi, @PowerrrBrrr 

 

Try to create a measure like this:

ave = 
var _t=FILTER(ALL(TableA),'TableA'[Class] in {"LAT"})
var _ID_list=SUMMARIZE(_t,[ID])
var _if=IF(ISINSCOPE(TableB[ID]),IF(MAX('TableB'[ID])in _ID_list,DIVIDE(SUM(TableB[value1])+SUM(TableB[value2]),2)))
return _if

 Result:

vangzhengmsft_0-1634177131691.png

Please refer to the attachment below for details. Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

selimovd
Super User
Super User

Hey @PowerrrBrrr ,

 

you can just calculate the average and set the filter context to LAT. The following measure should do it:

Average LAT =
CALCULATE(
    AVERAGE( 'Table B'[AverageSum] ),
    'Table A'[Class] = "LAT"
)

 

If you want to return only a value if LAT is in the context then you have to use the FILTER function:

Average LAT =
CALCULATE(
    AVERAGE( 'Table B'[AverageSum] ),
    FILTER(
        'Table A',
        'Table A'[Class] = "LAT"
    )
)

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

i am soory but it seems the AVERAGESUM you have taken as one column while it is different. Also dont take the column name as Average or Sum rather just take the column name as VALUE. i want all rows of Value for class LAT. I have formatted the table now

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors