The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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.