Forum Discussion
Heatmap slicer
- 5 years ago
Hey jeffwash666 ,
create a new "slicer table" with the rows "Red", "Green" and "Blue". This you can do in 2 ways:
1. With the "Enter data" function
2. With a DAX table (Modeling --> New Table):
myColorSlicer = DATATABLE ( "Color", STRING, { { "Red" }, { "Green" }, { "Blue" } } )Add a slicer to your report with the column "color" from the created table. Set the selection control to "Single select", that only one value is selected by the slicer.
Then create a measure that checks what is selected with the SELECTEDVALUE function and depending on the result you return the result of the corresponding column:
MyColorSum = VAR vSlicer = SELECTEDVALUE( myColorSlicer[Color] ) VAR vReturn = SWITCH( vSlicer, "Red", SUM( myTable[Red] ), "Green", SUM( myTable[Green] ), "Blue", SUM( myTable[Blue] ) ) RETURN vReturnIf you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution โ๏ธ and give it a thumbs up ๐Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
Hey jeffwash666 ,
create a new "slicer table" with the rows "Red", "Green" and "Blue". This you can do in 2 ways:
1. With the "Enter data" function
2. With a DAX table (Modeling --> New Table):
myColorSlicer = DATATABLE (
"Color", STRING,
{
{ "Red" },
{ "Green" },
{ "Blue" }
}
)
Add a slicer to your report with the column "color" from the created table. Set the selection control to "Single select", that only one value is selected by the slicer.
Then create a measure that checks what is selected with the SELECTEDVALUE function and depending on the result you return the result of the corresponding column:
MyColorSum =
VAR vSlicer = SELECTEDVALUE( myColorSlicer[Color] )
VAR vReturn =
SWITCH(
vSlicer,
"Red", SUM( myTable[Red] ),
"Green", SUM( myTable[Green] ),
"Blue", SUM( myTable[Blue] )
)
RETURN
vReturn