DAX - Using SWITCH() to change the background colour in a Power BI table
Тәжірибелік нұсқаулар және стиль
Power BI - Using the DAX SWITCH() function to change the background colour of a cell in a Power BI table. In this video I provide an example of the cell colour changing based upon the number of dates to a project deadline.
In Power BI DAX SWITCH() works a bit like a multiple-choice question. The SWITCH statement is given a value (here, the number of days to the deadline) and it gives you back a result (here, the cell colour).
This example provides a basic template of a SWITCH function which a user can expand upon for more complex conditions than that shown.
Timings:
00:00 - 01:10 Introduction
01:10 - 02:30 Create Measure to calculated number of days to deadline
02:30 - 05:40 Create Measure with SWITCH() statement to change cell colours
05:40 - 07:30 Recap steps taken and talk through example
07:30 - 08:30 Apply Measure containing SWITCH to cells of table.
#powerbi #powerbicolours #DAXSWITCH #SWITCH() #SWITCHfunction #powerbitutorial #dax #ChangeCellColour #changebackgroundcolor
Пікірлер: 34
Thank you very much indeed - that was exactly what I was looking for. Worked a treat. 🙂
@DFK_data
5 ай бұрын
Thanks! Glad you found the video helpful.
This was perfect, simple, and video well done! Thank you!
@DFK_data
Жыл бұрын
Thank you!
Thank you so much for making this video. I needed this!
@DFK_data
2 жыл бұрын
Thank you! Glad I could help
Very good and clear tutorial👍🏻👍🏻👍🏻
@DFK_data
Жыл бұрын
Glad you found the video helpful. Thanks!
Thanks a lot!!!!!!!! This video helps me a lot!
@DFK_data
Жыл бұрын
Thank you! Glad you found the video helpful.
Thank you for the video
@DFK_data
Жыл бұрын
Glad you enjoyed the video!
Thank you. This worked perfectly. =)
@DFK_data
Жыл бұрын
Thank you! I'm glad you found the video helpful
it helped a lot merci
@DFK_data
Ай бұрын
Thanks! Glad you found the video helpful
Nice and well detailed video.
@DFK_data
4 ай бұрын
Thank you!
Thank you so much👌
@DFK_data
2 жыл бұрын
Thank you for watching the video
Amazing
@DFK_data
8 ай бұрын
Thank you!
Very Good mam
@DFK_data
2 жыл бұрын
Thank you!
Thanks! Do you know if it's possible to dynamically set values and their colors with SWITCH() based on a column's distinct values? I can't hardcode values(too many and will probably change after refresh), but I need all distinct values colored differently (not count of distinct, no aggregations, just color each value with different color)
@DFK_data
Жыл бұрын
Hi, thanks for watching the video. Apologise, from your question I am not 100% clear on what you are trying to achieve. Perhaps Microsoft's Power BI community can suggest a solution if you provide an example of what you expect the final output to look like.
Hello, I watched your video but I can't assign the calculated object to the table, they appear disabled, what can I do? Thanks
@DFK_data
2 жыл бұрын
Hi, thanks for watching my video. Apologise, I am not fully understanding your question as I'm not clear on what is disabled. Do you have full edit rights to the Power BI report you are using? Perhaps someone else on KZread has come across this issue in relation to measures and tables and can help, or alternatively the Microsoft Power BI community is helpful as there you have the ability to provide screen prints of what is showing as disabled. Hope this helps.
Hai ma'am, if a cell contain text related information like Pass/Fail, Fail=Missing then how i can change colour in power bi
@DFK_data
Жыл бұрын
Hi, if you put the relevant column/measure into the switch statement and tell it on which values to change colour that should hopefully work. If you need help with your specific code, perhaps the Microsoft Power BI Community can help you.
how to do an entire specific row?? not just text
@DFK_data
2 жыл бұрын
Hi, I am not exactly clear what you are looking for, perhaps some else on KZread has created a video which provides an answer to your query. Alternatively Microsoft's Power BI Community may be able to assist you.
what if the task deadline was different for every task
@DFK_data
Жыл бұрын
Hi, thanks for watching the video. Apologise I am not clear on the question as in the example the tasks do have different deadlines. Perhaps someone in Microsoft's Power BI community can help if you provide an example. Hope this helps.