Forum Discussion
Incorrect Total for Percent Change in Power BI Matrix Visual
- 10 months ago
Hi andrelee,
Thanks for the file. That makes a whole lot more sense with context.
The number of field parameter tables certainly impacts things.
Try this (might not be perfect, but I think it's close):
Create new measures...
__pv = SWITCH( SELECTEDVALUE('Date Group'[Date Group Order]) , 0, SUM(ga_pops[ga_pageviews]) , 1, SUM(ga_pops[w_ga_pageviews]) , 2, SUM(ga_pops[m_ga_pageviews]) , 3, SUM(ga_pops[q_ga_pageviews]) , 4, SUM(ga_pops[y_ga_pageviews]) , SUM(ga_pops[ga_pageviews]) )__pv_pop = SWITCH( SELECTEDVALUE('Date Group'[Date Group Order]) , 0, SUM(ga_pops[dod_ga_pageviews]) , 1, SUM(ga_pops[wow_ga_pageviews]) , 2, SUM(ga_pops[mom_ga_pageviews]) , 3, SUM(ga_pops[qoq_ga_pageviews]) , 4, SUM(ga_pops[yoy_ga_pageviews]) , SUM(ga_pops[dod_ga_pageviews]) )__pv_%_Δ = DIVIDE( [__pv] - [__pv_pop] , [__pv_pop] , 0 ) * 100.0These are then used in the final switch calc...
_sw_pv_%_Δ = VAR __is_total = NOT ISINSCOPE('sites_py'[name]) && NOT ISINSCOPE('sites_py'[o&o]) && NOT ISINSCOPE('ga_pops'[device_type]) VAR __group_order = SELECTEDVALUE('Site Group'[Site Group Order]) VAR __result = IF( __is_total , SWITCH( __group_order , 0 , AVERAGEX( VALUES('sites_py'[name]) , CALCULATE([__pv_%_Δ]) ) , 1 , AVERAGEX( VALUES('sites_py'[o&o]) , CALCULATE([__pv_%_Δ]) ) , 2 , AVERAGEX( VALUES('ga_pops'[device_type]) , CALCULATE([__pv_%_Δ]) ) , BLANK() ) , [__pv_%_Δ] ) RETURN __resultI haven't had time to test 100%, I need to do my paid job 😄. Let me know how it goes or if you have questions.
Hi andrelee ,
Thank you for reaching out to the Microsoft fabric community forum. Also thank you Greg_Deckler , DaleT , KNP , danextian for your helpful response.
Could you please let us know if the issue has been resolved? I wanted to check if you had the opportunity to review the information provided.
If the above given solution doesn't meet your requirment, please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Want faster answers? How to Get Your Question Answered Quickly - Microsoft Fabric Community
Hope this helps. Please feel free to reach out for any further questions.
Thank you.
Thank you for checking. The issue is not resolved. I provided a link to the pbix file to KNP and Ashish_Mathur.