Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm trying to create a Measure that gives SUM of MINs under 2 different geography levels, but I couldn't sort it out after many attempts.
This is my table and data example
Geo1 | Geo2 | Category | Component | Qty |
A | A1 | CAT1 | Comp1 | 1 |
A | A1 | CAT1 | Comp2 | 2 |
A | A1 | CAT2 | Comp1 | 3 |
A | A1 | CAT2 | Comp2 | 4 |
A | A2 | CAT1 | Comp1 | 5 |
A | A2 | CAT1 | Comp2 | 6 |
A | A2 | CAT2 | Comp1 | 7 |
A | A2 | CAT2 | Comp2 | 8 |
This is the desired Measure output for 2 different configurations:
First Case:
Geo1 | Category | Result Measure Desired |
A | CAT1 | 6 |
A | CAT2 | 10 |
I expect this result because:
For Geo1 = A, Category = CAT1,
Sum(Comp1)=6, Sum(Comp2)=8
Min(6,8) = 6
Second case:
Geo1 | Geo2 | Category | Result Measure Desired |
A | A1 | CAT1 | 1 |
A | A1 | CAT2 | 3 |
A | A2 | CAT1 | 5 |
A | A1 | CAT2 | 7 |
I expect this result because:
For Geo1 = A, Geo2 = A1, Category = CAT1,
Sum(Comp1)=1, Sum(Comp2)=2
Min(1,2) = 1
For Geo1 = A, Geo2 = A2, Category = CAT1,
Sum(Comp1)=5, Sum(Comp2)=6
Min(5,6) = 5
Basically what I'm trying to do is to check at Geo1 Level and Category what's the minimum number of components available, and from there define the category result.
If I add Geo2, I pretend to have this measure reconstructed to recalculate the equation at that level.
In a practical example, if for Geo1 = US, CAT1 = PC, I have COMP1 = SCREEN, COMP2 = KEYBOARD, the minimum number of available PCs in US is equal to the minimum of SCREENs and KEYBOARDs in US, independently if they are in different cities. But I want to check the quantities of PCs that I have in Geo2 = New York City, the number would be the minimum of components in that city only. Hope it makes sense
I tried this option without any logic result:
Measure = SUMX ( VALUES ('Table'[Category]), ( CALCULATE( MINX( SUMMARIZE('Table','Table'[Geo1],'Table'[Category],'Table'[Component],"XX", SUM('Table'[Qty])) ,[XX]))) )
And this one:
Measure2 = MINX( SUMMARIZE('Table','Table'[Geo1],'Table'[Category],'Table'[Component],"XX", SUM('Table'[Qty])) ,[XX])
This last one works ok if I have Geo2 level, but if I remove it, the result is not recalculating at Geo1
I would appreciate some help.
Thanks and regards,
Pablo
What about something like this:
Min Measure = CALCULATE( MINX( ADDCOLUMNS( SUMMARIZE( Table1, Table1[Category], Table1[Geo1], Table1[Component] ), "Min", CALCULATE( SUM( Table1[Qty]) ) ), [Min] ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
81 | |
70 | |
61 |
User | Count |
---|---|
148 | |
116 | |
104 | |
89 | |
65 |