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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Sorting table with multiple columns

Hi All,

I need to create a Line and Stacked chart for which multiple columns will be derived using the following conditions:

Table name: Survey

Steps/Logic:

calculate the no. of surveys
Group by Support Group
Get the total count of rows
Sort the values by total responded surveys
Select only Top 50% = hence total rows/2
Take the 50% rows 
Sort it by highest % negative response 
Now display top 5 values in the chart 

 

Example data

 Group# of surveyNegative response %
A1480.68%
B671.49%
E195.26%
H382.63%
C372.70%
G7050.99%
D175.88%
F323.13%
H520.00%
L616.67%
K119.09%
N248.33%
I2010.00%
J1094.59%
M1301.54%
1 ACCEPTED SOLUTION

@Anonymous solution attached, look at table1 in attached, it has few columns and measures. you can play with it as per your need, didn't had much time to work on it thou but I guess you will get idea from it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

9 REPLIES 9
parry2k
Super User
Super User

@Anonymous will this "% negative response" will be aggregated for final output?

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hello @parry2k 

 

Thank you for the reply. No, it won't be aggregated. Aggregation is by Group only.

@Anonymous  is this expected output?

 

image.png



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Exactly!!! Am I missing something? I tried multiple ways but I am in one step behind the solution. Can you please explain?

@Anonymous solution attached, look at table1 in attached, it has few columns and measures. you can play with it as per your need, didn't had much time to work on it thou but I guess you will get idea from it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi @parry2k 

 

The below doesn't work and the Y/N column is empty for my case:

#_TOP = 
var x = TOPN([TOTAL_ROWS], VALUES('Table'[A), [B], DESC) 
RETURN
 IF('Table'[A] IN x, "Y")

Table is the table name, A, B are the columns. B is the column need to be sorted. Total_Rows is the rows to be taken in Top N.

Once I get the results, I need to rank the result set by Column C and get only Top 5 Rank. Can you please help on this issue? Thanks!

@Anonymousdoes the solution attached previosuly is not working?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hi @parry2k 

 

Thank you for the reply. I am getting ciurcular dependency 😞 

 

Below are the 2 screenshots for your reference. 

1.PNG2.PNG

The table is created using a DAX expression which is as below:

Table = 
VAR current_month= [#_LATEST_MONTH]

RETURN
SUMMARIZE(CUSTSURVEY, CUSTSURVEY[ASSIGNEE_SUPPORT_GROUP],

"#_of_Survey", 
CALCULATE(COUNT(CUSTSURVEY[ENTRY_ID]), FILTER(CUSTSURVEY, [#_GET_MONTH_AND_YEAR] = current_month && [#_IS_SURVEY_RESPONDED] = "Yes")), 

"% Negative Reviews", 
 (CALCULATE (
        COUNT ('CUSTSURVEY'[ENTRY_ID]),
        FILTER (
            'CUSTSURVEY',
            (
                'CUSTSURVEY'[#_GET_MONTH_AND_YEAR] = current_month
                    && (('CUSTSURVEY'[OVERALL_EXP] = 0)||('CUSTSURVEY'[OVERALL_EXP] = 1))
                    && NOT ISBLANK ('CUSTSURVEY'[OVERALL_EXP]) 
            )
        )
    )
        / CALCULATE (
            COUNT ( 'CUSTSURVEY'[ENTRY_ID] ),
            FILTER (
                'CUSTSURVEY',
                ( 'CUSTSURVEY'[#_GET_MONTH_AND_YEAR] = current_month
                    && ( 'CUSTSURVEY'[#_IS_SURVEY_RESPONDED] = "Yes" ) )
            )
        )
    )
)

Can you tell me what am missing? Thanks!

@Anonymous when you get chance, can you PM me?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.