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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
vjnvinod
Impactful Individual
Impactful Individual

Sorting of Bar Chart

 

Hi Team,

I am facing an issue with sorting a graph to display "Budget" first and "Actuals" second. Currently, as seen in the middle graph, "Actuals" appears first, followed by "Budget."

I am using measures for both "Budget" and "Actuals." How can I sort the graph so that "Budget" is always displayed first, regardless of whether "Actuals" exceed "Budget"?

Here are the measures I am using:

YTD Budget:

 

DAX
Copy code
YTD Budget = VAR CurrentMonth = CALCULATE( MAX('GroupOPEXCAPEX'[DateColumn]), GroupOPEXCAPEX[Actual/Budget] = "Actuals", 'GroupOPEXCAPEX'[Value] > 0, ALL(GroupOPEXCAPEX) ) VAR FilteredBudget = CALCULATE( [Budget], 'GroupOPEXCAPEX'[DateColumn] <= CurrentMonth, MONTH('GroupOPEXCAPEX'[DateColumn]) <= MONTH(CurrentMonth) // Filter for current and prior months of this year ) RETURN IF(FilteredBudget = BLANK(), BLANK(), FilteredBudget)

 

 

Actuals:

 

DAX
Copy code
Actuals = IF( ISBLANK( CALCULATE(SUM('GroupOPEXCAPEX'[Value]), 'GroupOPEXCAPEX'[Actual/Budget] = "Actuals") ), BLANK(), // Return BLANK if no value CALCULATE(SUM('GroupOPEXCAPEX'[Value]), 'GroupOPEXCAPEX'[Actual/Budget] = "Actuals") // Otherwise, return the sum )
 

Please advise on how to ensure consistent sorting with "Budget" appearing first.

Thank you!

 

 

vjnvinod_1-1735472929002.png

 

7 REPLIES 7
v-jingzhan-msft
Community Support
Community Support

Hi @vjnvinod 

 

It's quite strange that these regular methods don't work. Not sure if it's related to specific data. From your measures, you're only using the data in one table. Is it possible to share some sample data (dummy data) of the table so that we can try to reproduce the same behavior with your measure formula and find a solution?

 

Best Regards,
Jing

tharunkumarRTK
Super User
Super User

@vjnvinod 

You mentioned that Budget and Actuals are measures. You would have added those two measures into the Y Axis section of this column chart. Change its order to Budget and then Actuals. It should solve the problem.

 

Need a Power BI Consultation? Hire me on Upwork

 

 

 

Connect on LinkedIn

 

 

 








Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!


PBI_SuperUser_Rank@2x.png

@tharunkumarRTK 

 

unfortunately it doesn't work, have you tried in power bi pbix file?

 

vjnvinod_0-1735478125966.png

 

@vjnvinod 

It should sir

Here is an example 

A and then B

Screenshot 2024-12-29 at 6.49.34 PM.png

B and then A

Screenshot 2024-12-29 at 6.50.03 PM.png

 

Just check the sort order on the visual, if it is on the measure and descending then change it to the x axis field 

Screenshot 2024-12-29 at 6.51.18 PM.png

 

Need a Power BI Consultation? Hire me on Upwork

 

 

 

Connect on LinkedIn

 

 

 








Did I answer your question? Mark my post as a solution!
If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!


PBI_SuperUser_Rank@2x.png

@tharunkumarRTK 

 

unfortunately it doesn't work

 

 

vjnvinod_0-1735533434141.png

 

rajendraongole1
Super User
Super User

Hi @vjnvinod -you can create a custom column in your dataset to act as a sort order.

 

as like , Add a new column in your dataset with a custom numeric sort order for "Budget" and "Actuals."

SortOrder =
SWITCH(
'GroupOPEXCAPEX'[Actual/Budget],
"Budget", 1,
"Actuals", 2,
BLANK()
)

 

In the Fields pane, select the column containing "Actual/Budget."
Under the Column Tools tab, choose Sort by Column and select the SortOrder column created above.

 

Hope this approach helps to present always budget before actuals. Please check.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@rajendraongole1 

 

i have tried this, it doesn't work

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.