Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
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.
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.
Solved! Go to Solution.
@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] )
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.
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
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.
@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] )
Could you pelase helo me with what is flag as I'm very beginner
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.
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
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
12 | |
11 | |
11 | |
8 |