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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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