Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi so I have 2 tables with many to many relationship and I have a calculated column which subtracts (correctly) the Customary charge - amount = balance. So I have checked the math and it is correct, now I want to create a new column called Balance =Switch(True(),'Visit'[Balance] = 0, "Fully Paid", 'Visit'[Balance]> 0 && 'Visit'[Balance]< Visit[SumCustomary Charge] , "Partially Paid" , 'Visit'[Balance]= Visit[SumCustomary Charge], "Not Paid", 'Visit'[Balance]<0, "Negative Balance", 'Visit'[Balance] > Visit[SumCustomary Charge], "Amount Greater Than Charge" )
visit table
visit id | customary charge |
100 | 200 |
200 | 300 |
205 | 150 |
300 | 230 |
payment | amount |
100 | 200 |
200 | 203 |
205 | 150 |
300 | 0 |
result table should look like this
visit id | customary charge | amount | balance | tpye |
100 | 200 | 200 | 0 | Fully paid |
200 | 300 | 203 | 97 | Partially Paid |
205 | 150 | 150 | 0 | Fully Paid |
300 | 230 | 0 | 230 | Not Paid |
Solved! Go to Solution.
Hi @saanah2019 ,
Could you have create your [Balance] as a measure? Based on my test, you could refer to below measures:
Balance = CALCULATE(SUM(Visit[customary charge]))-CALCULATE(SUM(Table2[amount]))
type = Switch(True(),'Visit'[Balance] = 0, "Fully Paid", 'Visit'[Balance]> 0 && 'Visit'[Balance]< CALCULATE(SUM(Visit[Customary Charge])) , "Partially Paid" , 'Visit'[Balance]= CALCULATE(SUM(Visit[Customary Charge])), "Not Paid", 'Visit'[Balance]<0, "Negative Balance", 'Visit'[Balance] > CALCULATE(SUM(Visit[Customary Charge])), "Amount Greater Than Charge" )
Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
Hi @saanah2019 ,
Could you have create your [Balance] as a measure? Based on my test, you could refer to below measures:
Balance = CALCULATE(SUM(Visit[customary charge]))-CALCULATE(SUM(Table2[amount]))
type = Switch(True(),'Visit'[Balance] = 0, "Fully Paid", 'Visit'[Balance]> 0 && 'Visit'[Balance]< CALCULATE(SUM(Visit[Customary Charge])) , "Partially Paid" , 'Visit'[Balance]= CALCULATE(SUM(Visit[Customary Charge])), "Not Paid", 'Visit'[Balance]<0, "Negative Balance", 'Visit'[Balance] > CALCULATE(SUM(Visit[Customary Charge])), "Amount Greater Than Charge" )
Result:
You could also download the pbix file to have a view.
Regards,
Daniel He
User | Count |
---|---|
91 | |
73 | |
68 | |
63 | |
55 |
User | Count |
---|---|
99 | |
88 | |
73 | |
60 | |
58 |