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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
s082_sbux
Frequent Visitor

How to make filter in calculate measure dynamic

Hi,

 

I have a calculate measure to sum quantities of specific product code. Every 3 months new products need to be added in that list.

Is there any way make it dynamic instead of entering the product code inside IN need to update it in table.

 

s082_sbux_0-1713387099865.png

 

 i don't want to use IN as i need to edit the product code between double quotes and comma where the list getting bigger make it difficult.

2 ACCEPTED SOLUTIONS
Greg_Deckler
Community Champion
Community Champion

@s082_sbux Not unless you have some kind of flag or indicator on what to include. If you did then you could replace your manually typed table with somethig like:

SELECTCOLUMNS( FILTER( 'ilr', [Flag] = 1 ), "__Code", [Article Code] )



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Hi @Greg_Deckler ,thanks for the quick reply, I agree with your thoughts and I'll add to them further.

Hi @s082_sbux ,

As Greg_Deckler said, you need a column of data to determine whether the current code needs to be calculated or not.

A value of 1 in the 'Flag' column means that the calculation is required, while 0 means that it is not required.

vzhouwenmsft_0-1713424769415.png

Please follow these steps:

1.Use the following DAX expression to create a table

Table = SELECTCOLUMNS(FILTER('ilr','ilr'[Flag] = 1),"Code",'ilr'[ Article Code])

2.Use the following DAX expression to create a measure

Measure = CALCULATE(SUM(ilr[Qty]),'ilr'[ Article Code] IN DISTINCT('Table'[Code]))

3.Final output

vzhouwenmsft_1-1713424943841.png

If you don't have a column to determine if you want to calculate the value of the Code, it's completely random and you'll have to add the Code manually.

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@s082_sbux Not unless you have some kind of flag or indicator on what to include. If you did then you could replace your manually typed table with somethig like:

SELECTCOLUMNS( FILTER( 'ilr', [Flag] = 1 ), "__Code", [Article Code] )



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Could you pelase helo me with what is flag as I'm very beginner 

Anonymous
Not applicable

Hi @Greg_Deckler ,thanks for the quick reply, I agree with your thoughts and I'll add to them further.

Hi @s082_sbux ,

As Greg_Deckler said, you need a column of data to determine whether the current code needs to be calculated or not.

A value of 1 in the 'Flag' column means that the calculation is required, while 0 means that it is not required.

vzhouwenmsft_0-1713424769415.png

Please follow these steps:

1.Use the following DAX expression to create a table

Table = SELECTCOLUMNS(FILTER('ilr','ilr'[Flag] = 1),"Code",'ilr'[ Article Code])

2.Use the following DAX expression to create a measure

Measure = CALCULATE(SUM(ilr[Qty]),'ilr'[ Article Code] IN DISTINCT('Table'[Code]))

3.Final output

vzhouwenmsft_1-1713424943841.png

If you don't have a column to determine if you want to calculate the value of the Code, it's completely random and you'll have to add the Code manually.

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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.