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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ThomasSan
Helper IV
Helper IV

Create list of values in order to parse it into a filter with IN

Hi everyone,

I have a table that has the following structure:

LetterLetter Group
A1
B1
C1
D2
E2
F2
G3
H3
I3

 

I would like to get a list of letters by chosing a letter group. This list would then be needed in a FILTER segment of a CALCULATE function. 
An example would be as follows:

 

CALCULATE(
    sum('Table'[Values]),
    FILTER(
        'Table',
        'Table'[Letter] in {listofletters}
    )
)

where listofletters is a list of all letters from letter group 2 (so D, E, F)

 


As you can see, I am attempting to sum up all values of table 'Table' that are associated with the list of letters from Letter Group 2. My questions are the following:

1) Is my application of the FILTER function correct i.e. is it possible to parse in a list of values in the FILTER function so CALCULATE is only summing up values associated with the list of letters?

2) What is the proper DAX command in order to obtain such a list of letters?

Thank you for your help in advance!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ThomasSan , Something like this

 

CALCULATE(
sum('Table'[Values]),
FILTER(
'Table',
'Table'[Letter] in summarize(filter(Table, Table[Letter Group]=2), Table[Letter])
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
johnt75
Super User
Super User

You can get the values by using the VALUES function, so to get all the letters from letter group 2 you could use

VAR LettersFromGroup2 = CALCULATETABLE( VALUES( 'Table'[Letter]), 'Table'[Letter Group] = 2 )

but you don't need to do that. You can use the letter group column itself as a filter, so you could write your measure as 

Letter group 2 sum =
CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Letter Group] = 2 )

If the column you are filtering on is in the same table as the values you wish to sum then you may need to use REMOVEFILTERS if other columns from the same table are in the visual.

amitchandak
Super User
Super User

@ThomasSan , Something like this

 

CALCULATE(
sum('Table'[Values]),
FILTER(
'Table',
'Table'[Letter] in summarize(filter(Table, Table[Letter Group]=2), Table[Letter])
)
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

That was exactly what I was looking for. Thank you @amitchandak !

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.

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 community update carousel

Fabric Community Update - June 2025

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