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 PB expert,
It's prior to my previous post Dynamic Axis by selected percentage range
Please download the pbix here
I have a measure that can control the line chart, the line chart it will vary by the % range select,
Measure =
VAR _countC =
CALCULATE ( DISTINCTCOUNT ( 'Sheet1'[CustomerID] ), ALL ( 'Sheet1' ) )
VAR _percent =
ROUND ( DIVIDE ( 1, _countC ) * [Rank], 2 ) * 100
RETURN
IF (
_percent >= MIN ( 'Axis'[Axis] )
&& _percent <= MAX ( 'Axis'[Axis] ),
SUM ( Sheet1[Sales] ),
BLANK ()
)
However, the SUM is not what I expect
In the graph shown, the expected result = 65000.00,
Can any one help? many thanks!
Solved! Go to Solution.
Hi @Anonymous ,
Try to create your Rank measure as a column.
Rank Column =
RANKX (
ALL ( Sheet1[CustomerID] ),
CALCULATE ( SUM ( Sheet1[Sales] ), ALLEXCEPT ( Sheet1, Sheet1[CustomerID] ) ),
,
DESC
)
Then, replace "[Rank]" in your [Measure] with "MAX ( Sheet1[Rank Column] )".
Measure =
VAR _countC =
CALCULATE ( DISTINCTCOUNT ( 'Sheet1'[CustomerID] ), ALL ( 'Sheet1' ) )
VAR _percent =
ROUND ( DIVIDE ( 1, _countC ) * MAX ( Sheet1[Rank Column] ), 2 ) * 100
RETURN
IF (
_percent >= MIN ( 'Axis'[Axis] )
&& _percent <= MAX ( 'Axis'[Axis] ),
SUM ( Sheet1[Sales] ),
BLANK ()
)
Then, create another measure to get the total value:
Measure 2 = SUMX( VALUES( Sheet1[CustomerID] ) , [Measure] )
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Try to create your Rank measure as a column.
Rank Column =
RANKX (
ALL ( Sheet1[CustomerID] ),
CALCULATE ( SUM ( Sheet1[Sales] ), ALLEXCEPT ( Sheet1, Sheet1[CustomerID] ) ),
,
DESC
)
Then, replace "[Rank]" in your [Measure] with "MAX ( Sheet1[Rank Column] )".
Measure =
VAR _countC =
CALCULATE ( DISTINCTCOUNT ( 'Sheet1'[CustomerID] ), ALL ( 'Sheet1' ) )
VAR _percent =
ROUND ( DIVIDE ( 1, _countC ) * MAX ( Sheet1[Rank Column] ), 2 ) * 100
RETURN
IF (
_percent >= MIN ( 'Axis'[Axis] )
&& _percent <= MAX ( 'Axis'[Axis] ),
SUM ( Sheet1[Sales] ),
BLANK ()
)
Then, create another measure to get the total value:
Measure 2 = SUMX( VALUES( Sheet1[CustomerID] ) , [Measure] )
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous , Try like
Measure =
VAR _countC =
CALCULATE ( DISTINCTCOUNT ( 'Sheet1'[CustomerID] ), ALL ( 'Sheet1' ) )
VAR _percent =
ROUND ( DIVIDE ( 1, _countC ) * [Rank], 2 ) * 100
RETURN
sumx(values('Sheet1'[CustomerID]), IF (
_percent >= MIN ( 'Axis'[Axis] )
&& _percent <= MAX ( 'Axis'[Axis] ),
SUM ( Sheet1[Sales] ),
BLANK ()
))
Thanks so much, but it doesn't work
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 | |
97 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |