March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi ,
I am not able to figure this out.
I need to get total number of rows by each Product number. The product number , Sales and Code are from 3 different tables.
I need to get the result like in the last column Expected result count. Thanks a lot.
Product Number | Sales | Code | ! AA | Expected result ! Count |
101162 | 29 | L | 29 | 6 |
101162 | 23 | M | 29 | 6 |
101162 | 10 | S | 29 | 6 |
101162 | 23 | XL | 29 | 6 |
101162 | 3 | XS | 29 | 6 |
101162 | 12 | XXL | 29 | 6 |
1011621 | 94 | L | 94 | 6 |
1011621 | 74 | M | 94 | 6 |
1011621 | 36 | S | 94 | 6 |
1011621 | 76 | XL | 94 | 6 |
1011621 | 12 | XS | 94 | 6 |
1011621 | 47 | XXL | 94 | 6 |
11621100 | 120 | L | 120 | 6 |
11621100 | 94 | M | 120 | 6 |
11621100 | 46 | S | 120 | 6 |
11621100 | 98 | XL | 120 | 6 |
11621100 | 17 | XS | 120 | 6 |
11621100 | 62 | XXL | 120 | 6 |
1021160 | 37 | L | 37 | 7 |
1021160 | 30 | M | 37 | 7 |
1021160 | 13 | S | 37 | 7 |
1021160 | 30 | XL | 37 | 7 |
1021160 | 4 | XS | 37 | 7 |
1021160 | 15 | XXL | 37 | 7 |
1021160 | 127 | xxxs | 127 | 7 |
Solved! Go to Solution.
Hi @Puja
Can you check if the following measure works fine or not and let me know regarding the same.
TestMeasure =
VAR x =
SELECTEDVALUE ( 'Table'[Product Number] )
RETURN
SWITCH (
TRUE (),
x <> x, 98989,
CALCULATE (
COUNTROWS ( FILTER ( 'Table', 'Table'[Product Number] = x ) ),
ALL ( 'Table'[! AA] , 'Table'[Code], 'Table'[Sales])
)
)
Thank you.
If my answer helps you, please mark it as solution.
Hi,
some questions: I think to give a good answer we need the data model. Can you please post the related tables for your matrix. Are you sure, that you want to count everytime the total number in every group of
Product Number | Sales | Code | ! AA |
By interpreting this data it seems that "! AA" are not change the count: 7x times 1021160 but two different "! AA" numbers.
1021160 | 37 | L | 37 | 7 |
1021160 | 30 | M | 37 | 7 |
1021160 | 13 | S | 37 | 7 |
1021160 | 30 | XL | 37 | 7 |
1021160 | 4 | XS | 37 | 7 |
1021160 | 15 | XXL | 37 | 7 |
1021160 | 127 | xxxs | 127 | 7 |
So you have to make it more clear. The best thing are some example data.'
In general a simlar problem is discribed here:
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Measure-for-counting-ignoring-context-filters...
In your case this can work:
Measure = CALCULATE(COUNT('Table'[Product Number]),ALLEXCEPT('Table','Table'[Product Number]))
But you have to change it to your data model / name.
The result (data from one table in this example)
Proud to be a Super User!
Hi,
some questions: I think to give a good answer we need the data model. Can you please post the related tables for your matrix. Are you sure, that you want to count everytime the total number in every group of
Product Number | Sales | Code | ! AA |
By interpreting this data it seems that "! AA" are not change the count: 7x times 1021160 but two different "! AA" numbers.
1021160 | 37 | L | 37 | 7 |
1021160 | 30 | M | 37 | 7 |
1021160 | 13 | S | 37 | 7 |
1021160 | 30 | XL | 37 | 7 |
1021160 | 4 | XS | 37 | 7 |
1021160 | 15 | XXL | 37 | 7 |
1021160 | 127 | xxxs | 127 | 7 |
So you have to make it more clear. The best thing are some example data.'
In general a simlar problem is discribed here:
https://community.powerbi.com/t5/DAX-Commands-and-Tips/Measure-for-counting-ignoring-context-filters...
In your case this can work:
Measure = CALCULATE(COUNT('Table'[Product Number]),ALLEXCEPT('Table','Table'[Product Number]))
But you have to change it to your data model / name.
The result (data from one table in this example)
Proud to be a Super User!
Hi @Puja
Can you check if the following measure works fine or not and let me know regarding the same.
TestMeasure =
VAR x =
SELECTEDVALUE ( 'Table'[Product Number] )
RETURN
SWITCH (
TRUE (),
x <> x, 98989,
CALCULATE (
COUNTROWS ( FILTER ( 'Table', 'Table'[Product Number] = x ) ),
ALL ( 'Table'[! AA] , 'Table'[Code], 'Table'[Sales])
)
)
Thank you.
If my answer helps you, please mark it as solution.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
15 | |
7 | |
6 |
User | Count |
---|---|
33 | |
29 | |
16 | |
13 | |
12 |