Forum Discussion
Calulating against many different fields
- Anonymous3 years ago
Hi Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Unpivot the value type columns in Power Query Editor except [winpos] column
= Table.Unpivot(#"Changed Type", {"tcd", "tsp", "tgoing", "tcourse", "thorse", "t_val_rank"}, "Attribute", "Value")2. Create a measure as below to get the sum of value
Total Wins = CALCULATE ( SUM ( TrainerStats[Value] ), FILTER ( 'TrainerStats', TrainerStats[winpos] = 1 && TrainerStats[Attribute] IN ALLSELECTED ( 'TrainerStats'[Attribute] ) && 'TrainerStats'[Value] IN ALLSELECTED ( 'TrainerStats'[Value] ) ) )If the above one can't help you get the expected result, could you please provide some raw data in the table 'TrainerStats' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Hi Anonymous ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Unpivot the value type columns in Power Query Editor except [winpos] column
= Table.Unpivot(#"Changed Type", {"tcd", "tsp", "tgoing", "tcourse", "thorse", "t_val_rank"}, "Attribute", "Value")
2. Create a measure as below to get the sum of value
Total Wins =
CALCULATE (
SUM ( TrainerStats[Value] ),
FILTER (
'TrainerStats',
TrainerStats[winpos] = 1
&& TrainerStats[Attribute]
IN ALLSELECTED ( 'TrainerStats'[Attribute] )
&& 'TrainerStats'[Value] IN ALLSELECTED ( 'TrainerStats'[Value] )
)
)
If the above one can't help you get the expected result, could you please provide some raw data in the table 'TrainerStats' (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Let me first apologise for not providing sample data, and then to thank you for time and effort. It's much appreciated, and as well as answering my initial question has helped enourmously in my understanding of power bi. Thank you again.