Forum Discussion
Powerbi
Hi
I am getting this error,when i am trying calculate the targets
error:
Calculation error in measure targets_Ridership(Bus _Ridership_Green):A table of multiple values were supplied ,where a single value was expected
Code
SystemWide_Green = CALCULATE(VALUES(targets_Ridership[Target Threshold - Green]),FILTER(targets_Ridership, targets_Ridership[PM] = "Systemwide Ridership"))
This is the data:
| Month | Year | Category | PM | Target Description | Target Threshold - Green | Target Threshold Yellow |
| January | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| February | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| March | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| April | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| May | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| June | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| July | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| August | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| September | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| October | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| November | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| December | 2022 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| January | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| February | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| March | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| April | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| May | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| June | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| July | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| August | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| September | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.231 | 0.181 |
| October | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.104 | 0.054 |
| November | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.104 | 0.054 |
| December | 2023 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.104 | 0.054 |
| January | 2024 | Ridership | Systemwide Ridership | Increase from last year, with a 5% tolerance | 0.104 | 0.054 |
pls try this
16 Replies
- IdrissshatilaSuper User
Hello Himaja95 ,
but what are you trying to calculate, if you're trying to get the sum of this column then try the following measure:
SystemWide_Green = CALCULATE(SUM(targets_Ridership[Target Threshold - Green]),FILTER(targets_Ridership, targets_Ridership[PM] = "Systemwide Ridership")) - Himaja95Helper I
The code worked but its not showing the right numbers in the chart.
Yes I am trying to display the targets. and little calculation behind displaying the targets
Systems_Ridership_Gauge = ([SystemWide_Green]+1) * [Ridership Total Last Year All Modes]Ridership total last year is the (FY 2023 Actual ) column. in the below tableBy the above code you sent me its is showing 5.4M instead of 4.1Ridership Total Last Year All Modes Yellow Zone Green Target Oct 2024586 2133914 2235143 Nov 3791887 3996649 4186243 Dec 5443501 5737450 6009625 Jan 7284395 7677752 8041972 Feb 9006463 9492812 9943135 Mar 11052814 11649666 12202307 Apr 12935302 13633808 14280573 May 14843310 15644849 16387014 Jun 16667821 17567883 18401274 Jul 18517737 19517695 20443582 Aug 20608348 21721199 22751616 Sept 22784781 24015159 25154398 - Himaja95Helper I
Thank you for your response Fowmy
The code worked but its not showing the right numbers in the chart.
Yes I am trying to display the targets. and little calculation behind displaying the targets
Systems_Ridership_Gauge = ([SystemWide_Green]+1) * [Ridership Total Last Year All Modes]Ridership total last year is the (FY 2023 Actual ) column. in the below tableBy the above code you sent me its is showing 5.4M instead of 4.1Ridership Total Last Year All Modes Yellow Zone Green Target Oct 2024586 2133914 2235143 Nov 3791887 3996649 4186243 Dec 5443501 5737450 6009625 Jan 7284395 7677752 8041972 Feb 9006463 9492812 9943135 Mar 11052814 11649666 12202307 Apr 12935302 13633808 14280573 May 14843310 15644849 16387014 Jun 16667821 17567883 18401274 Jul 18517737 19517695 20443582 Aug 20608348 21721199 22751616 Sept 22784781 24015159 25154398 - AhmedxSuper User
pls try this
SystemWide_Green = CALCULATE(MAX(targets_Ridership[Target Threshold - Green]), KEEPFILTERS(FILTER(ALL(targets_Ridership), targets_Ridership[PM] = "Systemwide Ridership"))) -------or----------------------- SystemWide_Green = CALCULATE(MAX(targets_Ridership[Target Threshold - Green]), FILTER(ALL(targets_Ridership), targets_Ridership[PM] = "Systemwide Ridership"))- AhmedxSuper User
and try this
SystemWide_Green = CALCULATE(SUM(targets_Ridership[Target Threshold - Green]), KEEPFILTERS(FILTER(ALL(targets_Ridership), targets_Ridership[PM] = "Systemwide Ridership"))) -------or----------------------- SystemWide_Green = CALCULATE(SUM(targets_Ridership[Target Threshold - Green]), FILTER(ALL(targets_Ridership), targets_Ridership[PM] = "Systemwide Ridership")) - Himaja95Helper I
Thank you
Unfortunately didn't work for me,the code doesnt give any errors but its not displaying the right numbers
- AhmedxSuper User
share the file and show the target