Forum Discussion
No summation showing for the variable in the return statement
Hi,
I need some help on Power BI please. I have got three tables as FY_PREV , FILTER TABLE & S90(2). The relationship between FY_PREV , FILTER TABLE in the actual working file is inactive because it otherwise gives the error message for its ambiguous path and there is no relationship with S90(2) table. Then in FY_PREV table i have created two measures as
The other measure i have got is as below
I am trying to send a link for uploaded PBI sample file on Github, but i am not sure if i uploaded it correctly and if it will work
Power-BI/ at main · benedictmooray/Power-BI
https://github.com/benedictmooray/Power-BI/tree/main
If this link doesn't work and there is any other way of me sharing the PBI sample file link, please let me know.
Appreciate your any help.
Hi ,I think it's better If you divide this into few parts
first calculated sum of balance for FL P1
SumBalance_Flp1 = CALCULATE( SUM(fy_prev[balance]), fy_prev[conditional_column] = "FL P1" )then sum of balance for ML P1
SumBalance_mlp1 = CALCULATE( SUM(fy_prev[balance]), fy_prev[conditional_column] = "ML P1" )and the value coming from s90 table
S90 value = CALCULATE( SUM('S90 (2)'[WRITTEN OFF BAL]), 'S90 (2)'[DOM] = "MPA", 'S90 (2)'[P_TYPE] = "JDS Loans P2" )and then next you can create the the measure you want
Measure_6new = VAR S17 = 33726 VAR S16 = 4135 RETURN [SumBalance_mlp1] + [S90 value] + S17 + S16Total Amount outstanding = VAR S17 = 33726 VAR S16 = 4135 RETURN [S90 value] + [SumBalance_Flp1]+ S17 + S16
7 Replies
- kushanNa
Super User
Hi ,I think it's better If you divide this into few parts
first calculated sum of balance for FL P1
SumBalance_Flp1 = CALCULATE( SUM(fy_prev[balance]), fy_prev[conditional_column] = "FL P1" )then sum of balance for ML P1
SumBalance_mlp1 = CALCULATE( SUM(fy_prev[balance]), fy_prev[conditional_column] = "ML P1" )and the value coming from s90 table
S90 value = CALCULATE( SUM('S90 (2)'[WRITTEN OFF BAL]), 'S90 (2)'[DOM] = "MPA", 'S90 (2)'[P_TYPE] = "JDS Loans P2" )and then next you can create the the measure you want
Measure_6new = VAR S17 = 33726 VAR S16 = 4135 RETURN [SumBalance_mlp1] + [S90 value] + S17 + S16Total Amount outstanding = VAR S17 = 33726 VAR S16 = 4135 RETURN [S90 value] + [SumBalance_Flp1]+ S17 + S16- samioberoi
Helper III
Hi KushanNa,
Based on your calculate statement i used it in each variable separately and it did work. Thanks a lot for your help. - kushanNa
Super User
if you need only two mesures you can try this out
Measure_6new = VAR S17 = 33726 VAR S16 = 4135 VAR SumBalance_mlp1 = CALCULATE( SUM(fy_prev[balance]), fy_prev[conditional_column] = "ML P1" ) VAR S90_value = CALCULATE( SUM('S90 (2)'[WRITTEN OFF BAL]), 'S90 (2)'[DOM] = "MPA", 'S90 (2)'[P_TYPE] = "JDS Loans P2" ) RETURN SumBalance_mlp1 + S90_value + S17+S16Total Amount outstanding = VAR S17 = 33726 VAR S16 = 4135 VAR SumBalance_Flp1 = CALCULATE( SUM(fy_prev[balance]), fy_prev[conditional_column] = "FL P1" ) VAR S90_value = CALCULATE( SUM('S90 (2)'[WRITTEN OFF BAL]), 'S90 (2)'[DOM] = "MPA", 'S90 (2)'[P_TYPE] = "JDS Loans P2" ) RETURN SumBalance_Flp1 + S90_value + S16 +S17- kushanNa
Super User
and if you want to make it work for any value in conditional_column you can use this
S90 value = CALCULATE( SUM('S90 (2)'[WRITTEN OFF BAL]), 'S90 (2)'[DOM] = "MPA", 'S90 (2)'[P_TYPE] = "JDS Loans P2" )new measure = VAR S17 = 33726 VAR S16 = 4135 RETURN SUM(FY_PREV[BALANCE]) + [S90 value] + S17 + S16
- VahidDM
Super User
Hi samioberoi
Try this, ensure your lookup values are numeric and replace blanks with 0. For example, modify your measure as follows:
Total_Amount_outstanding = VAR S17 = 33726 VAR S16 = 4135 VAR cat_Balance = IF( ISBLANK( VALUE( LOOKUPVALUE( 'S90 (2)'[CAT BALANCE], 'S90 (2)'[DOM], "MPA", 'S90 (2)'[P_TYPE], "JDS LOANS P1" ) ) ), 0, VALUE( LOOKUPVALUE( 'S90 (2)'[CAT BALANCE], 'S90 (2)'[DOM], "MPA", 'S90 (2)'[P_TYPE], "JDS LOANS P1" ) ) ) VAR Adjustment_payment = IF( ISBLANK( VALUE( LOOKUPVALUE( 'S90 (2)'[Adjustment Pay], 'S90 (2)'[DOM], "MPA", 'S90 (2)'[P_TYPE], "JDS LOANS P1" ) ) ), 0, VALUE( LOOKUPVALUE( 'S90 (2)'[Adjustment Pay], 'S90 (2)'[DOM], "MPA", 'S90 (2)'[P_TYPE], "JDS LOANS P1" ) ) ) RETURN S17 + S16 + cat_Balance + Adjustment_paymentThis ensures that LOOKUPVALUE returns numeric values (using VALUE) and that blanks are replaced with 0 so the summation works correctly.
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
- samioberoi
Helper III
Hi VahidDM,
Thanks for trying to help. I tried your measure, but it doesn't work either. I don't know where the issue is. Were you able to access the sample data PBI file through the link?
Regards- VahidDM
Super User
Yes, please send it to me the PBIX file