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

dax - circular reference error with two measures using same filter

Hi All,

 

I am trying to create slicers based of sales quantity (no sales) over time. I can create the first measure which works well however if I create a second one with a different date filter I get a circular reference error. Can anyone please let me know how best to resolve this?

 

This works.....

 

No Sales 3 Months =
CALCULATE(
'tablename'[Quantity] == 0, Date[0-12 MonthsFlag] = TRUE()
)
 
If I create another I get the circular reference error:

No Sales 6  to 12 Months =
CALCULATE(
'tablename'[Quantity] == 0, Date[6-12 MonthsFlag] = TRUE()
)
 
Any assistance greatly appreciated. 
5 REPLIES 5
v-yiruan-msft
Community Support
Community Support

Hi @Anonymous ,

You can refer the method in the following links to resolve the problem of circular reference error. If they can't help you resolve the problem, please share with us about the sample data in fact able and the related formula of column [0-12 MonthsFlag] &[6-12 MonthsFlag] in order to provide you a suitable solution.

Circular reference error

Avoiding circular dependency errors in DAX

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks Amit,  I cannot make blanks = 0, I need strictly values that  = 0.
I have thousands of records that are blank and thousands that = 0. I only want values that are strictly 0 in value and exlude all that are blank.
I do understand your code in sort but this is not working for me. Kind Regards Fred

Anonymous
Not applicable

 Amit,

 

The first issue I see is that I cannot use Blanks as I have many records that are actually blank and I need to exclude these. I need this to work only when the value is == 0. The second is that I wish to use this measure as a slicer.. as in True or False. I do like your example. Thank you.

@Anonymous , you can try like

Rolling 3 =

var _1= CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date]),0),-3,MONTH))+0

 

return

if(_1 =0 , 1, 0)

amitchandak
Super User
Super User

@Anonymous , refer to this blog, how can you get no sales by just using ins blank

https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458

 

example

 

Rolling 3 =

var _1=  CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date]),0),-3,MONTH))

 

return

if(isblank(_1), 1, 0)

 


Rolling 6 before 6 =

var _1 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],eomonth(MAX('Date'[Date]),-6),-6,MONTH))

 

return

if(isblank(_1), 1, 0)

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.