Forum Discussion
Using parameters in calculated columns
I'm a bit confused here. I hope you can help me with this problem.
For a housing association I want to make a forecast of the rental income for the next five years.
I have to calculate this individually for each year and for each house because of company policies and state regulations. So I have to use calculated columns instead of measurements. Correct me if I'm wrong.
For example: if the rent of a house is lower than roughly 60% of the maximum rent of that specific house, then the rent must increase more than if the rent is 80% of the maximum rent.
And this check should be done every year.
I have included a number of parameters for the rent increase in my report so that the housing association can see what the effect will be on total income.
As far as I know you can't use parameters in calculated columns in PowerBi.
Is there a work around I can use?
2 Replies
- Greg_DecklerCommunity Champion
JeroenN Correct, parameters (what if parameters) will not affect calculated columns. You will need to use a measure. You should be able to use a measure it will just be a bit more complicated and you will have to deal with measure totals most likely.
To go further, would need sample data. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2. - JeroenNAdvocate I
This is a small example of the data I use.
House_Id CurrentRent MaximumRent %Rent P0001 840 1050 80% P0002 642 652 98% P0003 548 1026 53% P0004 849 1178 72% P0005 428 676 63% P0006 578 854 68% P0007 637 854 75% P0008 560 1046 54% P0009 601 1176 51% P0010 410 684 60% P0011 870 1027 85% P0012 668 1199 56% P0013 714 968 74% P0014 472 933 51% P0015 687 1143 60% P0016 814 1200 68% P0017 657 685 96% P0018 665 722 92% P0019 442 747 59% And the parameters on the report:
Parameters Rent < 60% MaxRent 4,00% Rent 60 - 75% MaxRent 3,00% Rent 75 - 90% MaxRent 2,00% Rent > 90% MaxRent 0,00% And the result should be:
House_Id Rent Year 1 Rent Year 2 Rent Year 3 Rent Year 4 Rent Year 5 P0001 856,80 873,94 891,41 909,24 927,43 P0002 642,00 642,00 642,00 642,00 642,00 P0003 569,92 592,72 616,43 634,92 653,97 P0004 874,47 900,70 918,72 937,09 955,83 P0005 440,84 454,07 467,69 481,72 496,17 P0006 595,34 613,20 631,60 650,54 663,55 P0007 656,11 669,23 682,62 696,27 710,19 P0008 582,40 605,70 629,92 648,82 668,29 P0009 625,04 650,04 676,04 703,08 731,21 P0010 426,40 439,19 452,37 465,94 479,92 P0011 887,40 905,15 923,25 941,72 941,72 P0012 694,72 722,51 744,18 766,51 789,50 P0013 735,42 750,13 765,13 780,43 796,04 P0014 490,88 510,52 530,94 552,17 574,26 P0015 707,61 728,84 750,70 773,22 796,42 P0016 838,42 863,57 889,48 916,16 934,49 P0017 657,00 657,00 657,00 657,00 657,00 P0018 665,00 665,00 665,00 665,00 665,00 P0019 459,68 473,47 487,67 502,30 517,37 And of course: totals by city, province and country.
So each year the rent is based on the rent in the previous year. In formula:
Rent Year i = Rent Year i-1 * ( 1 + a )
Where a is based on Rent Year i-1 / Maximum Rent and one of the four parameters.