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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Sorting Stacked Bar Chart by Axis Values

Hi Member, 

 

In the following Graph- I am looking to sort the values on Axis (Screen Time) either ascendingly/ descendingly.

Can anyone suggest how do i proceed. 

 

image.png

 

 

 

1 ACCEPTED SOLUTION

Hi,

 

Do not write a calculated column formula.  Write a formula in the Query Editor instead

 

=If [Status]="Considered" then [Interview Date]-[Application Date] else null


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

9 REPLIES 9
Ashish_Mathur
Super User
Super User

Hi,

 

In the Data Model, it looks like to the screen time column is formatted as a text column.  Change the formatting to Numbers.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

And yes, Ashish- It was formatted as Text earlier.

Hi,

 

So does the graph now pan out correctly?  If yes, then please mark my reply as Answer.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish,

 

I tried this- to change Text to Column

Changed Data Type udner Formatting from Text to Whole Numbers.

 

And then, the Screen Time Column started showing #Error for all values and under modelling shows "Cannot convert value '' of type Text to type Integer."

Is there something wrong with my syntax in modelling?

 

Screen Time = IF('Raw Data'[Status]="Considered",
FORMAT(DATEDIFF('Raw Data'[Application Date],'Raw Data'[Interview Date],DAY),""),
"")
 
Thanks

 

 

Hi,

 

Do not write a calculated column formula.  Write a formula in the Query Editor instead

 

=If [Status]="Considered" then [Interview Date]-[Application Date] else null


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish,

 

The graph looks the way i wanted it to, but it is not showing odd values on Y Axis. 

How can i make it plot all values? image.png

 

Look at the axis options.  There should be some setting there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish, It did work. Thanks again.

May i know why we used Query Editor and not the Add Column in Data.

You are welcome.  I am sure it can also be solved by using a calculated column.  In a calculated column, you can only have a single data type.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors