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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Index column in calculated table

Hello, guys!

Created dynamic date scales 

https://www.inkeysolutions.com/blogs/power-bi-dynamic-scales-values/

 

and got the problem. The x-axis sorted in a wrong way

test_1.PNG

 

I created an "index" column in calculated table to fix it:

Range = IF('DateSlicer'[Frequency] = "Monthly", LOOKUPVALUE('Calendar'[Month], 'Calendar'[Month + year short round 2], 'DateSlicer'[Value]), IF('DateSlicer'[Frequency] = "Quarterly", LOOKUPVALUE('Calendar'[Quarter], 'Calendar'[Quarter&Year], 'DateSlicer'[Value]), IF('DateSlicer'[Frequency] = "Yearly", LOOKUPVALUE('Calendar'[Year], 'Calendar'[Year_2], 'DateSlicer'[Value]), 0)))
33455.PNG

 

Tried to sort  Value by Range and ... got the system message: 

error.PNG

 

All I need is Sort Value in right ascending order in x-axis (Jan '18, Feb '18 etc). 

How could I do this ? 

 

 

 

 

10 REPLIES 10
Anonymous
Not applicable

So, the solution is.

add adition column via union - formulae below. (Calendar[Current date] - measure)

 

UNION(
SUMMARIZE ('Calendar', 'Calendar'[Month&Year], "Frequency", "Monthly", "Sorting", 'Calendar'[Current date]),
SUMMARIZE ( 'Calendar', 'Calendar'[Quarter&Year], "Frequency", "Quarterly", "Sorting", 'Calendar'[Current date]),
SUMMARIZE ( 'Calendar', 'Calendar'[Year], "Frequency", "Yearly", "Sorting", 'Calendar'[Current date])
)

 

and Sort by Sorting column.

 

Thanks @sayaliredij for idea.

 

SOLVED

Anonymous
Not applicable

Hello @Anonymous ,

 

You can create sort column in power query editor. by extracting month and year in two separate column and then create custom column two combine that yearmonth like 20181 and then use that column to sort.

 

Then you will not have circular depedency issue in report.

 

#"Inserted Month" = Table.AddColumn(#"Changed Type", "Month", each Date.Month([Date_Added]), Int64.Type),
#"Inserted Year" = Table.AddColumn(#"Inserted Month", "Year", each Date.Year([Date_Added]), Int64.Type),
#"Changed Type1" = Table.TransformColumnTypes(#"Inserted Year",{{"Month", type text}, {"Year", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "Custom", each [Year]&""&[Month])

Anonymous
Not applicable

its caclculated table. i cant use power querty editor unfortunelly.

Angith_Nair
Continued Contributor
Continued Contributor

Hi @Anonymous ,

Create a sorting column in DateSlicer Table like this:

SortOrder = Month ( 'DateSlicer'[Value])

Then Sort Value column by SortOrder column.

Angith_Nair_0-1616506667213.png

This will resolve your issue..
If this helps, please mark this as a solution. Appreciate with Kuddos.

Anonymous
Not applicable

Can`t do this. ''DateSlicer'[Value]  has text format.

sayaliredij
Solution Sage
Solution Sage

You can include Year + month as Index and sort accordingly 

 

eg. Jan 18  - 201801

      Feb 18  - 201802

 

Regards,

Sayali

 





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

Proud to be a Super User!




Anonymous
Not applicable

Yes, it works with numbers. But i need this month labels - Jan, Feb etc

you can keep the column with the Month name, create an additional column index with not 1 or 2 numbers but 201801, 201802.. 

you can sort month column using index column 





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

Proud to be a Super User!




Anonymous
Not applicable

Thanks @selimovd for your reply. 

 

I am not sure, if its help. Cause the main problem - Circular dependency. Or, it will  definitely help?

selimovd
Super User
Super User

Hey @Anonymous ,

 

the values in the sort by column have to be unique for the same value.

So Jan'18 can be 1, but then Jan'19 cannot be 1.

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.