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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I'm pretty new to DAX and I'm trying to solve a problem.
I need to calculate the sum of Fees from the year to a date
Here is an exemple
Date 1 | Date 2 | Fees
01/2018 | 06/2018 | 5
02/2018 | 03/2018 | 3
03/2018 | 08/2018 | 14
11/2017 | 06/2019 | 21
If I pick Date 1 = 03/2018 & Date 2 = 06/2018 my result should be 8
If I pick Date 1 = 03/2018 & Date 2 = 08/2018 my result should be 22
If I pick Date 1 = 12/2017 & Date 2 = 06/2018 my result should be 21
I used this formula :
Fees = CALCULATE( SUM('Fraisdesante-20190926'[frais_base]); FILTER( ALL('Fraisdesante-20190926'[monthid_soins_date]); 'Fraisdesante-20190926'[monthid_soins_date] <= MAX('Fraisdesante-20190926'[monthid_soins_date]) ); FILTER( ALL('Fraisdesante-20190926'[monthid_soins_date]); YEAR('Fraisdesante-20190926'[monthid_soins_date]) = YEAR(MAX('Fraisdesante-20190926'[monthid_soins_date])) ); FILTER( ALL('Fraisdesante-20190926'[monthid_compt_date]); 'Fraisdesante-20190926'[monthid_compt_date] <= MAX('Fraisdesante-20190926'[monthid_compt_date]) ); FILTER( ALL('Fraisdesante-20190926'[monthid_compt_date]); YEAR('Fraisdesante-20190926'[monthid_compt_date]) = YEAR(MAX('Fraisdesante-20190926'[monthid_compt_date]))))
But when I pick the case : Date 1 = 12/2017 & Date 2 = 06/2018
the result is <Blanck>
Thanks in advance
Solved! Go to Solution.
@Anonymous
You may drag [Date] from a separate calendar table and apply virtual relationship in DAX measure.
@Anonymous
You may drag [Date] from a separate calendar table and apply virtual relationship in DAX measure.