Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Circular dependency

I have a month column. No date only month.
I then created a Month Number.
Month Number =
SWITCH('Account Changes 2016-2022'[Month],
"January",1,
"February",2,
"March",3,
"April",4,
"May",5,
"June",6,
"July",7,
"August",8,
"September",9,
"October",10,
"November",11,
"December",12
)
I created a slicer with month name. But it was not in chronological order. I sorted the column by month number. But it gave me circular dependency error. How do I fix this?
I want to arrange month name in chronological order. 
Thank you
  • One way to solve this is to add the Month Number column in the query editor instead of DAX.

     

    You can do this with a custom column like this:

    Date.Month(Date.From(([Month] & " 2000")))

    (Appending the " 2000" allows it to interpret e.g. "January 2000" as a date and then compute the month number for that date.)

2 Replies

  • One way to solve this is to add the Month Number column in the query editor instead of DAX.

     

    You can do this with a custom column like this:

    Date.Month(Date.From(([Month] & " 2000")))

    (Appending the " 2000" allows it to interpret e.g. "January 2000" as a date and then compute the month number for that date.)

  • ppm1's avatar
    ppm1
    Solution Sage

    The suggestion to do it in the query editor is a good one. Otherwise, you have two DAX options:

    1. If you have another Date column in that table, use that to generate the Month Number column.

    2. First create a duplicate column with Month2 = 'Account Changes 2016-2022'[Month]. Then point your switch column to the new Month2 column.

     

    Pat