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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
LAPSA_LAB
Frequent Visitor

Dépendence circulaire

Bonjour, 

 

Je cherche à calculer sur une table l'activité ou non d'un magasin en fonction du chiffre d'affaire qu'il a rapporté durant un mois. 

J'ai donc utiliser la formule suivante pour le mois M dans une table 'Calcul' contenant le 'CIP' qui est relié à la table 'Pharmacien' : 

 
Mois_M = IF ( CALCULATE ( SUM ( sales_order[V_sous_total_HT] ) ,  sales_order[status] <> "canceled" , Pharmacien[CIP] , MONTH ( sales_order[created_at] ) > MONTH ( EDATE ( TODAY() , -1 ) ) , YEAR ( sales_order[created_at] ) = YEAR ( TODAY () ) ) > 0 , "Active", "Inactive" )
 
Cela me donne bien le résultat cherché. En revanche, lorsque je veux effectuer un calcul similaire pour le mois M-1, je fais le calcul suivant :
 
Mois_M-1 = IF ( CALCULATE ( SUM ( sales_order[V_sous_total_HT] ) , sales_order[status] <> "canceled" , Pharmacien[CIP] , MONTH ( sales_order[created_at] ) = MONTH ( EDATE ( TODAY() , -1 )) , YEAR ( sales_order[created_at] ) = YEAR ( EDATE ( TODAY(), -1)) ) > 0 , "Active" , "Inactive" )
 
Cela m'indique le message suivant : Une dépendance circulaire a été détectée : Calcul[Mois_M-1], Calcul[Mois_M], Calcul[Mois_M-1].
Je ne comprends pas d'où vient cette dépendance, car les calculs sont indépendants normalement (on calcule juste si le chiffre d'affaires d'un mois donné est supérieur à 0 puis on remplit la case par "Active" ou "Inactive" en fonction du résultat).
Pouvez-vous m'aider ?
 
Merci beaucoup ! 
1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @LAPSA_LAB 

 

I'd like to suggest you refer to the following article about how to avoid circular dependency.

Avoiding circular dependency errors in DAX

 

Best Regards

Allan

 

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

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @LAPSA_LAB 

 

I'd like to suggest you refer to the following article about how to avoid circular dependency.

Avoiding circular dependency errors in DAX

 

Best Regards

Allan

 

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

Pragati11
Super User
Super User

Hi @LAPSA_LAB ,

 

I see that in your both DAX expressions there is one difference:

 

Mois_M = IF ( CALCULATE (SUM (sales_order [V_sous_total_HT]), sales_order [status] <> "canceled", Pharmacist [CIP], MONTH (sales_order [created_at])> MONTH (EDATE (TODAY (), -1)), YEAR (sales_order [created_at]) = YEAR (TODAY ()))> 0, "Active", "Inactive")

 

Month_M-1 = IF (CALCULATE (SUM (sales_order [V_sous_total_HT]), sales_order [status] <> "canceled", Pharmacist [CIP], MONTH (sales_order [created_at]) = MONTH (EDATE (TODAY (), -1) ), YEAR (sales_order [created_at]) = YEAR (EDATE (TODAY (), -1)))> 0, "Active", "Inactive")

 

Trying to understand the GREEN part highlighted above. In this you are using EQUAL sign.

In the RED part highlighted above, you are using GREATER THAN sign, which is checking a condition.

 

So, is you 2nd DAX correct for M-1 ?

 

Thanks,

Pragati

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors