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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Ezzeldin
Helper I
Helper I

Circular Dependency why using sort by column

Dears,

 

I have 2 calculated columns called: LEVEL_1 and Sorting 

 

Ezzeldin_0-1689071964598.png

 

LEVEL_1 Column is used for grouping and depending on the ID column

 

Ezzeldin_1-1689072131489.png

 

The sorting Column specifies the sort of each value in the LEVEL_1 column

 

Ezzeldin_2-1689072272824.png

 

when I try to use the Sort by column option on the LEVEL_1 column it gives me the following error

Ezzeldin_3-1689072437902.png

 

how can I overcome the Circular Dependency error using DAX or any other solution without relying on an Excel sheet; because I want to make the grouping dynamically generated from the database without user intervention?

 

 

2 ACCEPTED SOLUTIONS

Hi @Ezzeldin ,

Please create the 2 columns in power query.

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

thank you so much, when I create both columns on the power query it works fine. also, I have done another solution by making both columns reference the ID column not each other.

View solution in original post

6 REPLIES 6
v-rongtiep-msft
Community Support
Community Support

Hi @Ezzeldin ,

If that's the case, I suggest you do it in Power query.

Please refer to my steps.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("NcixDcAgDATAXahTvDHG/7Mg9l8jETHd6dZqPQBY208xixR1qO6wUWTOODS4By+nfooZwy7Fb/cL", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [ID]>=250000 and [ID]<=259999 then "Accumulated Depreciation" else if[ID]>=920000 and [ID]<=929999 then "Bank clearing Accounts" else if [ID]>=100000 and [ID]<=109999 then "Cash &Banks" else if [ID]>=980000 and [ID]<=989999 then "Other Clearing Accounts" else " "),
    #"Renamed Columns" = Table.RenameColumns(#"Added Custom",{{"Custom", "level _1"}}),
    #"Added Custom1" = Table.AddColumn(#"Renamed Columns", "Custom", each if [level _1] = "Accumulated Depreciation" then 1 else if [level _1] = "Bank clearing Accounts" then 2 else if [level _1] = "Cash &Banks" then 3 else if [level _1] = "Other Clearing Accounts" then 4 else 5)
in
    #"Added Custom1"

vrongtiepmsft_0-1689233034698.png

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I already try the custom column in the power query to create the "Sorting" Column and then use the "Sort by column" option on the level_1 column and still I face the same error.

Hi @Ezzeldin ,

Please create the 2 columns in power query.

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

thank you so much, when I create both columns on the power query it works fine. also, I have done another solution by making both columns reference the ID column not each other.

v-rongtiep-msft
Community Support
Community Support

Hi @Ezzeldin ,

I have created a simple sample, please refer to my pbix file.

LEVEL_1 = SWITCH(TRUE(),'Table'[ID]>=250000&&'Table'[ID]<=259999,"Accumulated Depreciation",
'Table'[ID]>=920000&&'Table'[ID]<=929999,"Bank Clearing Accounts",
'Table'[ID]>=100000&&'Table'[ID]<=109999,"Cash &Banks",
'Table'[ID]>=980000&&'Table'[ID]<=989999,"Other clearing Accounts",
BLANK())
Column =
SWITCH (
    TRUE (),
    'Table'[LEVEL_1] = "Accumulated Depreciation", 1,
    'Table'[LEVEL_1] = "Bank Clearing Accounts", 2,
    'Table'[LEVEL_1] = "Cash &Banks", 3,
    'Table'[LEVEL_1] = "Other clearing Accounts", 4,
    5
)

vrongtiepmsft_0-1689214552814.png

 

 

When you create a Calculated column in the Report View you will get this error because the column which is created based a Column Cannot Sort the Same column because is Dependent on that Column (with a Formula).

 

 

How to Get Your Question Answered Quickly 

 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

 

Best Regards
Community Support Team _ Rongtie

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

level_1 is created to be used in a P&L visual; so I want when I list level_1 column values in the visual to follow a specific sorting that I specified in the column "Sorting".
for doing so, on the level_1 column, I choose the "Sort by column" option and then choose the "Sorting" column to sort each value in the Level_1 column by the sorting specified in the "Sorting" Column.
after doing so the error of Circular Dependency occurs.

Ezzeldin_0-1689228782866.png

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.