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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sachingupta31
New Member

Sorting a Funnel in Power BI on a custom column

Hello,

I am trying to create a Funnel in Power BI. I created a custom column name "StageOrder" which will have below code

StageOrder =
Switch(

TRUE(),
'Table_Name'[column_name] = "New", 1,
'Table_Name'[column_name] = "Marketing Engaged", 2
'Table_Name'[column_name] = "Marketing Qualified", 3,
'Table_Name'[column_name] = "Sales Accepted", 4,
'Table_Name'[column_name] = "Sales Qualified", 5,
'Table_Name'[column_name] = "Opportunity", 6,
'Table_Name'[column_name] = "won", 7,
BLANK()
)

 

When I see the funnel in the power BI front end report, I try to sort the funnel based on StageOrder column, but that column is not available for sorting. Below is how my funnel is coming up.

funnel.PNG

I have gone through some of the articles to see if custom sorting is possible in Power BI and tried some of the solutions as well like use the StageOrder column in the tooltip filter. I tried that but that is coming as countOfStageOrder or DistinctCountOfStageOrder or AverageOfStageOrder like that. Below is the link i went through to solve this but did not work for me.

https://community.fabric.microsoft.com/t5/Desktop/Sorting-a-funnel-chart/m-p/3775403

I am not able to sort this funnel based on the stageOrder precedence I gave. Can someone please help me to overcome this issue?

 

Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @sachingupta31 

The sorting column in the case you referenced is generated through Power Query:

vjianpengmsft_0-1728353160294.png

You can refer to the PBIX in PowerQuery to perform the same operation and obtain this custom sorted funnel.
I will demonstrate the process of creating a calculated column through DAX and then sorting the funnel in the following dataset:
First, I use the following DAX expression to generate a calculated column:

StageOrder = SWITCH(TRUE(),
    'Table'[Category]="A",3,
    'Table'[Category]="B",2,
    'Table'[Category]="C",1,
    'Table'[Category]="E",4,
    'Table'[Category]="D",5)

I then use the following DAX expression to create a calculated column that replicates our Category column to avoid a circular dependency:

Column = 'Table'[Category]

vjianpengmsft_1-1728353240925.png

Next, sort the Column column by the StageOrder column:

vjianpengmsft_2-1728353289977.png

Use column in the category of the funnel chart and use the value field in values:

vjianpengmsft_3-1728353354616.png

vjianpengmsft_4-1728353409025.png

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @sachingupta31 

The sorting column in the case you referenced is generated through Power Query:

vjianpengmsft_0-1728353160294.png

You can refer to the PBIX in PowerQuery to perform the same operation and obtain this custom sorted funnel.
I will demonstrate the process of creating a calculated column through DAX and then sorting the funnel in the following dataset:
First, I use the following DAX expression to generate a calculated column:

StageOrder = SWITCH(TRUE(),
    'Table'[Category]="A",3,
    'Table'[Category]="B",2,
    'Table'[Category]="C",1,
    'Table'[Category]="E",4,
    'Table'[Category]="D",5)

I then use the following DAX expression to create a calculated column that replicates our Category column to avoid a circular dependency:

Column = 'Table'[Category]

vjianpengmsft_1-1728353240925.png

Next, sort the Column column by the StageOrder column:

vjianpengmsft_2-1728353289977.png

Use column in the category of the funnel chart and use the value field in values:

vjianpengmsft_3-1728353354616.png

vjianpengmsft_4-1728353409025.png

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi, @sachingupta31 

The sorting column in the case you referenced is generated through Power Query:

vjianpengmsft_0-1728353160294.png

You can refer to the PBIX in PowerQuery to perform the same operation and obtain this custom sorted funnel.
I will demonstrate the process of creating a calculated column through DAX and then sorting the funnel in the following dataset:
First, I use the following DAX expression to generate a calculated column:

StageOrder = SWITCH(TRUE(),
    'Table'[Category]="A",3,
    'Table'[Category]="B",2,
    'Table'[Category]="C",1,
    'Table'[Category]="E",4,
    'Table'[Category]="D",5)

I then use the following DAX expression to create a calculated column that replicates our Category column to avoid a circular dependency:

Column = 'Table'[Category]

vjianpengmsft_1-1728353240925.png

Next, sort the Column column by the StageOrder column:

vjianpengmsft_2-1728353289977.png

Use column in the category of the funnel chart and use the value field in values:

vjianpengmsft_3-1728353354616.png

vjianpengmsft_4-1728353409025.png

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.