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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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