Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hello,
I'm trying to calculate the category average of vendors, but view the specific vendor. I need to make my formula calculate the score of the category that the selected vendor is in. It currently is showing the same average value for all 4 categories, when they should be different. What do I need to change in my formula?
Solved! Go to Solution.
Hi @torishriver ,
Please try sample pbix and let me know.
Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
Hi @torishriver,
Thank you @Praful_Potphode for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
Hi @torishriver ,
Please try sample pbix and let me know.
Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
Hi @torishriver,
Thank you for reaching out to Microsoft Fabric Community.
Thank you @pcoley and @FBergamaschi for the prompt response.
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided by the user's for the issue worked? or let us know if you need any further assistance.
Thanks and regards,
Anjan Kumar Chippa
Can you share the pbix via a could service or send it via mail in a private message? That would speed things up
Anyway, you need to iterate the categories to make your code work, so you need something like
If this helped, please consider giving kudos and mark as a solution@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
Thank you for responding, Francesco. Unfortunately I cannot share the PBI dashboard with you as it has customer sensitive data. Your solution also didn't work for me, but I think it has to do with the way I built the measures that I'm referencing in this formula.
The main issue in your current measure is how the filter context and SELECTEDVALUE interact when a single vendor (or multiple vendors) is selected in a table/matrix visual.
When you put [Vendor Name] on rows and this measure in values:
Remove SELECTEDVALUE and let the existing row context from the visual (or slicer) set the category automatically.
You only need to remove the vendor filter — keep the category filter coming from the visual.
%_VendorScore_Avg_Category = VAR brand = 0.14 VAR eob = 0.13 VAR finance = 0.17 VAR service = 0.18 VAR supplychain = 0.14 VAR technology = 0.09 VAR opportunity = 0.15 RETURN CALCULATE ( ([#_BrandScore_Avg] * brand) + ([#_EaseofBusiness_Avg] * eob) + ([#_Finance_Avg] * finance) + ([#_Service_Avg] * service) + ([#_SupplyChain_Avg] * supplychain) + ([#_Technology_Avg] * technology) + ([#_Opportunity_Avg] * opportunity), REMOVEFILTERS ( 'Vendor Scorecard'[Vendor Name] ) -- optionally: REMOVEFILTERS ( 'Vendor Scorecard'[Vendor Name], other columns you want to ignore ) )
If you have a complex filter setup and the category context is being lost, you can capture the vendor's category first:
%_VendorScore_Avg_Category = VAR brand = 0.14 VAR eob = 0.13 VAR finance = 0.17 VAR service = 0.18 VAR supplychain = 0.14 VAR technology = 0.09 VAR opportunity = 0.15 VAR CurrentVendorCategory = CALCULATE( SELECTEDVALUE ( 'Vendor Scorecard'[Category] ), REMOVEFILTERS ( 'Vendor Scorecard'[Vendor Name] ) // optional — usually not needed here ) RETURN IF( ISBLANK ( CurrentVendorCategory ), BLANK(), // or return grand total if preferred CALCULATE ( ([#_BrandScore_Avg] * brand) + ([#_EaseofBusiness_Avg] * eob) + ([#_Finance_Avg] * finance) + ([#_Service_Avg] * service) + ([#_SupplyChain_Avg] * supplychain) + ([#_Technology_Avg] * technology) + ([#_Opportunity_Avg] * opportunity), REMOVEFILTERS ( 'Vendor Scorecard'[Vendor Name] ), 'Vendor Scorecard'[Category] = CurrentVendorCategory ) )
But in 90% of typical vendor/category scorecard reports, the first (simpler) version is enough and cleaner.
Thank you for responding. Unfortunately this solution also didn't work for me, but I think it has to do with the way I built the measures that I'm referencing in this formula. The category is not a filter on my page, my page is being filtered to a specific vendor via a slicer, but I want this value to be calculated across all vendors that have the same category as the one in the slicer. I don't know if that changes anything though.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 |