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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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