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 everyone.
I have this scenario: 219 plants ("Production Unit" or "PU") are located in 15 geographical regions. They produce only one product in different amounts. Data is collected monthly. Visually:
The data model is the following:
What I need to do is a "PU" Top 20 (Plant Top 20) in chart 2 (chart in the right side) only if there is no Region selected in chart 1 (chart in the left side). If there is at least one Region selected, then chart 2 is simply filtered by that Region showing only the plants located there.
What I did
I added a calculated column in plant table (T_PU) named Rank:
Rank =
RANKX(
ALL(T_PU);
CALCULATE([Sum of Production])
)
And these measures:
Sum of Production = SUM(FT_Production[Production])
Production by PU =
IF(
[No of Selected Regions] <> [No of Total Regions];
//This is True when at least one region is selected
CALCULATE([Sum of Production]); CALCULATE([Production Top 20])
)
No of Selected Regions = DISTINCTCOUNT(T_Region[id_region])
No of Total Regions =
CALCULATE( DISTINCTCOUNT(T_Region[id_region]); ALL(T_Region)
)
Production Top 20 =
CALCULATE(
[Sum of Production];
T_PU[Rank] <= 20
)
What I got...
Two issues:
1. A quasi-Top 20 chart.
The Top 20 chart seems to be ok but.. The order is not quite right:
2. When a Region is selected the resulting chart only shows some plants (in some regions, it shows no plant at all).
Maybe some of my steps are not appropriate. Or maybe I need a complete different approach. Any suggestion will be welcome.
Regards!
Fabo
Solved! Go to Solution.
Hi, Please try with this measure:
ProductionShow = IF ( HASONEVALUE ( T_Region[Region] ), [Sum of Production], IF ( COUNTROWS ( INTERSECT ( VALUES ( T_PU[Production Unit] ), TOPN ( 20, ALLSELECTED ( T_PU[Production Unit] ), [Sum of Production], DESC ) ) ) > 0, [Sum of Production], BLANK () ) )
Regards
Victor
Lima - Peru
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 |
---|---|
112 | |
97 | |
85 | |
67 | |
59 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |