Skip to content

Instantly share code, notes, and snippets.

@hdary85
Created February 1, 2024 04:52
Show Gist options
  • Save hdary85/f5d8814741a6c0ee5da12ec3518d3ced to your computer and use it in GitHub Desktop.
Save hdary85/f5d8814741a6c0ee5da12ec3518d3ced to your computer and use it in GitHub Desktop.
Dax
Taux_Variation_Produit =
VAR Ventes_Semestre1 = CALCULATE(SUM('TableVentess'[Ventes]), 'TableVentess'[Semestre] = 1)
VAR Ventes_Semestre2 = CALCULATE(SUM('TableVentess'[Ventes]), 'TableVentess'[Semestre] = 2)
VAR Ventes_Produit = CALCULATE(SUM('TableVentess'[Ventes]), ALLEXCEPT('TableVentess', 'TableVentess'[Produit]))
RETURN
IF(ISBLANK(Ventes_Semestre1) || ISBLANK(Ventes_Semestre2) || Ventes_Semestre1 = 0, BLANK(), (Ventes_Semestre2 - Ventes_Semestre1) / Ventes_Produit)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment