Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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]))
)
)
 
DataScientistR_0-1619831735699.png

 

DataScientistR_1-1619831867697.png

 

2 REPLIES 2
Anonymous
Not applicable

@amitchandak This is my report. The filter on the top right I selected the Category to be "Pais" (Country in spanish) and all the catergories in most of the visual are "Peru" "Colombia" "Ecuador" "Bolivia" and so on. However, I would like to sort my countries based on a specific order. The Index column in my dax table is for the group. First, Ransa then Canal then Pais and so on.

 

DataScientistR_1-1619891700667.png

 

 

DataScientistR_0-1619891389162.png

 

amitchandak
Super User
Super User

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors