Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello Community!
I have the Calendar table related to the Table1 table by the field Calendar[Date] - Table1[Date] and related to the Table2 table by the field Calendar[Date] - Table2[Date].
I need a mesure to calculate the sum of values of the Amount field according to this condition:
And I create this measure:
Measure =
But the measurement results are not correct because it returns records that do not match the condition I need. What is wrong with the DAX formula?
Thank you.
Solved! Go to Solution.
Of course:
Measure =
Hi @amitchandak,
Thank you for your comment but the result it's the same as with my formula. Any other suggestions?
Hi @Raul,
Can you please share some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
HI @Raul,
Did amitchandak 's suggestion help with your scenario? if that is the case, you can consider Kudo or accept his suggestions to help others who faced similar requirements find it more quickly.
If these also don't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
@Raul , Try like
Measure =
VAR varYear = SELECTEDVALUE(Calendar[Year])
RETURN
CALCULATE(SUM(Table2[Amount]), filter(Table2, Table2[Date]>= DATE(varYear+1,09,01) && Table2[Date]<= DATE(varYear+1,12,31))) +
CALCULATE(SUM(Table1[Amount]), filter(Table1,Table1[Date] >= DATE(varYear,01,01) && Table1[Date] <= DATE(varYear,03,31)))
or
Measure =
VAR varYear = SELECTEDVALUE(Calendar[Year])
RETURN
CALCULATE(SUM(Table2[Amount]), filter(Table2, Table2[Date]>= DATE(varYear+1,09,01) && Table2[Date]<= DATE(varYear+1,12,31)), all(calendar)) +
CALCULATE(SUM(Table1[Amount]), filter(Table1,Table1[Date] >= DATE(varYear,01,01) && Table1[Date] <= DATE(varYear,03,31)), all(calendar))
Hi @amitchandak and @v-shex-msft
I solved my question by creating a variable for each option and sum both variables.
Thank you for your help.
Hi @amitchandak and @v-shex-msft
I solved my question by creating a variable for each option and sum both variables.
Thank you for your help.
Hi @Raul,
I'm glad to hear you find the solution.😊
BTW, did you mind sharing a sample formula for this? I think it will help other users who were looking for a similar formula.
Regards,
Xiaoxin Sheng
Of course:
Measure =
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
85 | |
82 | |
66 | |
49 |
User | Count |
---|---|
137 | |
111 | |
101 | |
66 | |
65 |