Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I have created a field parameters slicer named "Analysis" for different measures and used the field parameters table "Analysis" in the Y-axis of the column chart. The dynamic selection of slicer values is reflected in the column chart accordingly. Using conditional formatting, I want to highlight the highest value with one color and the rest of the columns with a common color. I created a measure with the formula below and applied it as fx in the column section. Upon applying and dynamic selection, it doesn't reflect the colors at the intended places as shown in the screenshot. How to fix this?
Formula:
Screenshots of the visual and table:
Solved! Go to Solution.
Hi @learner24
You measure will not work because SELECTEDMEASURE not work with field parameter rather it works with calculation group. You can debug by returning simply _CurrentValue and you will see the result is blank.
Also you need to compare current value with the summarized value, other wise you would not be able to identify max value.
So to make it dynamic, you need to repeate same operation for each measure, then use selected value, compare using if or switch condition and return desired result.
Try this below code (I have only 2 measure, since you have 5, then repeate same operation for 5 of them):
MaxColumnColor =
VAR _selectedMeasure = SELECTEDVALUE(Analysis[Analysis Order])
//For Revenue
VAR _ValueTableRev = CALCULATETABLE(ADDCOLUMNS(SUMMARIZE('Calendar', 'Calendar'[Month]), "@Rev", [Revenue]), ALLSELECTED())
VAR _MaxValueRev = MAXX(_ValueTableRev, [@Rev])
VAR _RevCol = SWITCH(TRUE(), [Revenue]=_MaxValueRev, "Green", "Gray")
//For Quantity
VAR _ValueTableQty = CALCULATETABLE(ADDCOLUMNS(SUMMARIZE('Calendar', 'Calendar'[Month]), "@Qty", [OrderQty]), ALLSELECTED())
VAR _MaxValueQty = MAXX(_ValueTableQty, [@Qty])
VAR _QtyCol = SWITCH(TRUE(), [OrderQty]=_MaxValueQty, "Purple", "Gray")
//Result
VAR _Result =
SWITCH(
TRUE(),
_selectedMeasure = 0, _QtyCol,
_selectedMeasure = 1, _RevCol,
"Blue"
)
RETURN
_Result
I have used Order of field parameter than name. It is easy.
Here is my desired output:
When Order Qty:
When Revenue:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Hi @learner24 ,
I assume that the x-axis of the histogram is Table[Bin].
MEASURE =
VAR __cur_measure_order =
SELECTEDVALUE ( 'Analysis'[Parameter Order] )
VAR __max_total_customers =
MAXX ( ALL ( 'Table'[Bin] ), [Total Customer] )
VAR __max_total_revenue =
MAXX ( ALL ( 'Table'[Bin] ), [Total Revenue] )
VAR __max_total_rewards =
MAXX ( ALL ( 'Table'[Bin] ), [Total Rewards] )
VAR __max_total_transactions =
MAXX ( ALL ( 'Table'[Bin] ), [Total Transactions] )
VAR __max_avg_revenue =
MAXX ( ALL ( 'Table'[Bin] ), [Average Revenue] )
VAR __max_avg_rewards =
MAXX ( ALL ( 'Table'[Bin] ), [Average Rewards] )
VAR __result =
SWITCH (
__cur_measure_order,
0, IF ( [Total Customer] = __max_total_customers, "#38220f", "#967259" ),
1, IF ( [Total Revenue] = __max_total_revenue, "#38220f", "#967259" ),
2, IF ( [Total Rewards] = __max_total_rewards, "#38220f", "#967259" ),
3, IF ( [Total Transactions] = __max_total_transactions, "#38220f", "#967259" ),
4, IF ( [Average Revenue] = __max_avg_revenue, "#38220f", "#967259" ),
5, IF ( [Average Rewards] = __max_avg_rewards, "#38220f", "#967259" )
)
RETURN
__result
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @learner24
You measure will not work because SELECTEDMEASURE not work with field parameter rather it works with calculation group. You can debug by returning simply _CurrentValue and you will see the result is blank.
Also you need to compare current value with the summarized value, other wise you would not be able to identify max value.
So to make it dynamic, you need to repeate same operation for each measure, then use selected value, compare using if or switch condition and return desired result.
Try this below code (I have only 2 measure, since you have 5, then repeate same operation for 5 of them):
MaxColumnColor =
VAR _selectedMeasure = SELECTEDVALUE(Analysis[Analysis Order])
//For Revenue
VAR _ValueTableRev = CALCULATETABLE(ADDCOLUMNS(SUMMARIZE('Calendar', 'Calendar'[Month]), "@Rev", [Revenue]), ALLSELECTED())
VAR _MaxValueRev = MAXX(_ValueTableRev, [@Rev])
VAR _RevCol = SWITCH(TRUE(), [Revenue]=_MaxValueRev, "Green", "Gray")
//For Quantity
VAR _ValueTableQty = CALCULATETABLE(ADDCOLUMNS(SUMMARIZE('Calendar', 'Calendar'[Month]), "@Qty", [OrderQty]), ALLSELECTED())
VAR _MaxValueQty = MAXX(_ValueTableQty, [@Qty])
VAR _QtyCol = SWITCH(TRUE(), [OrderQty]=_MaxValueQty, "Purple", "Gray")
//Result
VAR _Result =
SWITCH(
TRUE(),
_selectedMeasure = 0, _QtyCol,
_selectedMeasure = 1, _RevCol,
"Blue"
)
RETURN
_Result
I have used Order of field parameter than name. It is easy.
Here is my desired output:
When Order Qty:
When Revenue:
Hope this helps!!
If this solved your problem, please accept it as a solution and a kudos!!
Best Regards,
Shahariar Hafiz
Hi @learner24
I think this video might help you.
https://www.youtube.com/watch?v=IpTNX_MZLPs
https://www.youtube.com/watch?v=pWKfXIGFmK0
I hope I answered your question!
User | Count |
---|---|
119 | |
78 | |
59 | |
52 | |
48 |
User | Count |
---|---|
171 | |
117 | |
61 | |
59 | |
53 |