Forum Discussion
Converting Tableau calculation
I have searched but haven't found exactly what I am looking for. I have a Tableau Calculation that I am trying to convert to Power BI. It is a weighted average, and in Tableau there are a couple of calculations that cascade to get to the final.
Wieght 1 = SUM([Area SF])/WINDOW_SUM(SUM([Area SF]), FIRST(), last())Weight 2 = AVG([Net pEUI Reduction Percent])*[Weight 1]Weighted Average = window_sum([Weight 2])
How can I / what is the best way to convert this to Power BI?
2 Replies
- Greg_DecklerCommunity Champion
MichaelRensing These generally go better if you provide sample data and expected output. You could try this for a weighted average: Better Weighted Average per Category - Microsoft Fabric Community
Otherwise, 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.- MichaelRensingHelper I
Thanks for the response. I am looking to find a weighted average of Net pEUI (decimal value), weighted by the area (square footage) of a project. The Visual will show the Net pEUI, and I would like to show the weighted average for all projects on the visual. The visual could be filtered by Reporting Year and by Primary Use Type. (Sample of data set below)
Project number Area SF Net pEUI Reduction Percent Reporting year Primary Use Type 12692.1 75999 44 2022 Health Care - Medical Office 12868.71 33500 44 2022 Health Care - Medical Office 13137.04 210000 58 2023 Education - College/University (campus-level) 13159.07 610000 28.27 2021 Health Care - Hospital Inpatient 13337.02 43900 42 2020 Retail Store 13453.01 49000 44 2023 Public Assembly - Library 13470.03 64809 44 2023 Public Assembly - Entertainment/Culture 13550.01 10498 42 2021 Health Care - Medical Office 13697.02 170361 26 2021 Office - Large 13697.03 48631 63 2023 Education - College/University (campus-level) 13703.01 52579 27.58 2021 Health Care - Hospital Inpatient 13745.01 67931 42 2021 Public Assembly - Entertainment/Culture 13750.01 5700 63.4 2021 Office - Small ( < 10,000 sf) 13921.01 56371 31.4 2021 Public Assembly - Recreation 13964.02 35249 10 2021 Office - Medium (< 100,000 sf) 13966.01 133938 42 2021 Health Care - Medical Office 13992.01 11700 50 2022 Public Assembly - Library 14049.02 56500 42 2021 Health Care - Medical Office 14081.01 153100 65.12 2021 Education - College/University (campus-level) 14087.01 54573 24.03 2020 Lodging - Residence Hall/Dormitory 14094.02 11203 66.37 2022 Education - College/University (campus-level) based on the above data, project number 13159.07 has a Net pEUI 28.27, 13750.01 has a Net pEUI of 63.4. These 2 projects do not have equal effects on the weighted average since the 13159.07 project has an area 610,000 sqft where 13750.01 has an area of 5,700 sqft. The former's area is much greater than the later so the 2 Net pEUI's are not equal. The weighted average of the 2 example projects would be somewhere around 28.587 Net pEUI. so the 1st projects pEUI has the greatest impact due to the weighting.
I hope this makes sense.