Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I'm new to PowerBI and this forum. I apologise if this has been covered in a previous question: I hope it hasn't, or that this brings something useful to the community.
The data I have is as below, minus the column (variable) 'healthpertotal'.
It shows the amount of government spending (column 'value') on health, and its total spending aka expenditure (both in column 'function'), and its associated year of that spending (column 'year).
I want to make a new column that shows the percent of government health spending over its total spending, for a given year, as shown below in the column 'healthpertotal'.
So for instance, in 1995, the value of this variable is (42587(health spending amount)/326420(total spending amount))*100=13.05.
As for the rows showing total spending, the 'healthpertotal' could be 'missing', 1 or 'not applicable' and the like. I am ok with any of these options.
How would I set up this new column 'healthpertotal'?
Thanks for your time and kind consideration.
function | year | value | healthpertotal |
Health | 1995 | 42587 | 13.05 |
Health | 1996 | 44209 | 13.25 |
Health | 1997 | 44472 | 13.07 |
Total | 1995 | 326420 | |
Total | 1996 | 333637 | |
Total | 1997 | 340252 |
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi,
Please check the below picture and the attached pbix file.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Hi, I accepted the answer earlier as I'm sure that it would work. Now I'm back at my desktop and testing this code, it return the error: "A single value for column 'Function' in table 'data1' cannot be determined". It goes on to say "This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."
I'm not sure what has caused this. The column 'function' only has the values 'Health' and 'Total'.
Hope you could still help.
Thanks
Hi,
May I ask to share your sample pbix file?
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
99 | |
99 | |
80 | |
77 | |
66 |
User | Count |
---|---|
134 | |
106 | |
105 | |
86 | |
72 |