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 Team,
I have this below visual :
Blue color bars are current temperature. I want to show bar in different colors(cool=blue, orange=heat, green=fan) from which Usermode this comes from.
I don't want to drag this user mode column into the legend field as that will show every fields in legend as below:
legend should only display current temperature, Average site temp, set point temp, fan speed.
User mode should be displayed in different colors for current temp bars and even a data label to show as usermode as heat,auto,cool etc.
Please advise!
PFA file here Heatsense - Copy - Copy.pbix
Thanks in advance!
@marcorusso @Jihwan_Kim @Greg_Deckler @amitchandak @Ahmedx
Hi @sivarajan21
When you remove DeviceID from the X axis the CF will stop working, it's dependent on DeviceID being on the X axis.
With you have a date column on the x axis, how do you know what UserMode to use? There are multiple UserModes for each date.
The labels on the visual are for the numeric data values, you already have the DeviceID's shown on the x axis.
Regards
Phil
Proud to be a Super User!
Hi @PhilipTreacy ,
Thanks for your quick response!
Apologise for the delay in response and we tested on it.
Agree with your point! but we have to select user mode where iscurrent column is 1.
For example, Below is the visual where deviceid selected is B0965C2B9CF2A6C855A3C245F6B72F1A:
The color of the current temp should vary according to the user mode where iscurrent is 1. Therefore in this case, usermode is auto
So color should be grey. your below measure is useful but i am confused how to apply them for above visual when updatedon date column is in x-axis.
Column Color =
VAR _UserMode = SELECTEDVALUE('HeatSense_Device'[UserMode])
RETURN
SWITCH(
TRUE(),
_UserMode = "cool", "#12239E",
_UserMode = "heat", "#FF8C00",
_UserMode = "fan", "green",
"#808080"
)
Please advise!
PFA file here Heatsense - Copy - Copy.pbix
Thanks in advance!
@marcorusso @Greg_Deckler @PhilipTreacy @lbendlin @Jihwan_Kim @Ahmedx @v-linyulu-msft @v-yaningy-msft
Hide the legend?
Hi @lbendlin ,
Apologise for not being clear!
We need the legend for current temp, setpoint temp, fan speed & average temp except user mode.
User mode should be reflected on bars in different colors and their respective labels marking them as Orange for heat, Blue for cool, pink for fan and grey for auto.
@PhilipTreacy answer is got it correct but we wanted it to work when Date column is in x-axis.
Thanks in advance!
First, create a measure for color-coding based on Usermode:
daxCopyColorByUsermode =
SWITCH(
VALUES(Table[Usermode]),
"cool", "#0066CC", // Blue
"heat", "#FF6600", // Orange
"fan", "#33CC33", // Green
"#0066CC" // Default blue
)
Create a measure for the legend labels:
daxCopyLegendLabel =
VAR CurrentMode = VALUES(Table[Usermode])
RETURN
SWITCH(
TRUE(),
SELECTEDVALUE(Table[Measure]) = "Current Temperature",
"Current Temp (" & CurrentMode & ")",
SELECTEDVALUE(Table[Measure]) = "Average Site Temperature",
"Avg Site Temp",
SELECTEDVALUE(Table[Measure]) = "Set Point Temperature",
"Set Point Temp",
SELECTEDVALUE(Table[Measure]) = "Fan Speed",
"Fan Speed",
"Other"
)
Then to implement this:
Remove the Usermode from the legend field
In the format pane:
Use the ColorByUsermode measure for the bar colors
Use the LegendLabel measure for the legend text
Add a data label to show the Usermode text on the bars
Best Regards
Saud Ansari
If this post helps, please Accept it as a Solution to help other members find it. I appreciate your Kudos!
Hi @sivarajan21
Here's your file with the code below in it
Write this DAX which sets the color for the columns
Column Color =
VAR _UserMode = SELECTEDVALUE('HeatSense_Device'[UserMode])
RETURN
SWITCH(
TRUE(),
_UserMode = "cool", "blue",
_UserMode = "heat", "orange",
_UserMode = "fan", "green",
"grey"
)
Then apply that as a Conditional Formatting rule
Note that the grey columns don't have an associated UserMode, hence they are grey.
Regards
Phil
Proud to be a Super User!
Hi Phil,
Thanks for your quick response!
Your dax is perfect and works when deviceid is on X-axis.
But when I dragged UpdatedOn date column from Heatsense Device table into x-axis different colors doesn't work:
Also, is it possible to label them as cool, heat, fan on their respective colors?
Please advise!
PFA updated file here Heatsense - Copy - Copy.pbix
Thanks in advance!
@PhilipTreacy @lbendlin @saud968 @marcorusso @Greg_Deckler @Ahmedx @Jihwan_Kim
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 |
---|---|
134 | |
91 | |
89 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |