Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hi everybody,
I'm a new user of Power BI and would like tu use variables in functions but i don't understand how it works.
I would like to use this function :
Part Privé N =
CALCULATE(
SUM([Solde]);[Exercice]=30/06/2016)
I would like to replace '30/06/2016' by a variable in order to change it easily.
Also, Il would like to use this same variable for other functions.
Could you please help me ?
Thank you
Solved! Go to Solution.
You can use variables as following formulas. Here [Latest_Exercice] is a measure which always returns the latest date. You can also use other measures which returns a value.
This is just a sample and we need to adjust the formulas according to the actual requirement.
Measure 1:
Latest_Exercice = MAX ( Table1[Exercice] )
Measure 2:
Part Privé N = VAR Exercice = [Latest_Exercice] RETURN ( CALCULATE ( SUM ( [Solde] ), Table1[Exercice] = Exercice ) )
Best Regards,
Herbert
Hi,
I am trying to calculate the YoY, QoQ & MoM using your Dax variable formula, but i am stuck at applying filters at calculated function
Week_Ref | ST | Date |
2017W01 | 20,998 | 10/31/2016 0:00 |
2016W01 | 18,939 | 11/2/2015 0:00 |
Table - TIme
Date | Date LY | Week | Week LY |
10/31/2016 0:00 | 11/2/2015 0:00 | 2017W01 | 2016W01 |
11/7/2016 0:00 | 11/9/2015 0:00 | 2017W02 | 2016W02 |
10/30/2017 0:00 | 10/31/2016 0:00 | 2018W01 | 2017W01 |
11/6/2017 0:00 | 11/7/2016 0:00 | 2018W02 | 2017W02 |
You can use variables as following formulas. Here [Latest_Exercice] is a measure which always returns the latest date. You can also use other measures which returns a value.
This is just a sample and we need to adjust the formulas according to the actual requirement.
Measure 1:
Latest_Exercice = MAX ( Table1[Exercice] )
Measure 2:
Part Privé N = VAR Exercice = [Latest_Exercice] RETURN ( CALCULATE ( SUM ( [Solde] ), Table1[Exercice] = Exercice ) )
Best Regards,
Herbert
HI?
Thank you for your solution. It works well !
Sincerely
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.