Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Add an Index column

Hello everyone I created a slicer table so that I can get dynamic categories in my visual.

Depends on the category I choose my visual would change. However I would like to set an specific orden for the group PAIS within the column category so I am kinda lost here. The column index in my dax table is for sorting the Selection Column 

 

 

Dax Table

Slicer table =
UNION(
SELECTCOLUMNS(VALUES(Mailing_DB[Ransa]),"selection","Ransa","category",Mailing_DB[Ransa],"index",1),
SELECTCOLUMNS(VALUES(Mailing_DB[CANAL]),"selection","Canal","category",Mailing_DB[CANAL],"index",2),
SELECTCOLUMNS(VALUES(Mailing_DB[PAIS]),"selection","Pais","category",Mailing_DB[PAIS],"index",3),
SELECTCOLUMNS(VALUES(Mailing_DB[TIPODELOGÍSTICA]),"selection","Tipo de Logística","category",Mailing_DB[TIPODELOGÍSTICA],"index",4),
SELECTCOLUMNS(VALUES(Mailing_DB[TIPODEMAILING]),"selection","Tipo de Mailing","category",Mailing_DB[TIPODEMAILING],"index",5)
 
Measure
Enviados (dynamic) =
VAR category_selectiong = SELECTEDVALUE('Slicer table'[selection],"Paises")
RETURN
SWITCH(
TRUE(),
category_selectiong = "Canal",CALCULATE([# enviados]+0,TREATAS(VALUES('Slicer table'[category]),Mailing_DB[CANAL])),
category_selectiong = "Pais",CALCULATE([# enviados]+0,TREATAS(VALUES('Slicer table'[category]),Mailing_DB[PAIS])),
category_selectiong = "Tipo de Logística",CALCULATE([# enviados]+0,TREATAS(VALUES('Slicer table'[category]),Mailing_DB[TIPODELOGÍSTICA])),
category_selectiong = "Tipo de Mailing",CALCULATE([# enviados]+0,TREATAS(VALUES('Slicer table'[category]),Mailing_DB[TIPODEMAILING])),
category_selectiong = "Ransa",CALCULATE([# enviados]+0,TREATAS(VALUES('Slicer table'[category]),Mailing_DB[Ransa]))
)
)
 

 

 

2 Replies