Forum Discussion
andrelee
10 months agoFrequent Visitor
Incorrect Total for Percent Change in Power BI Matrix Visual
Dear Community, I have a Matrix visual in Power BI where one of the columns represents the percent change in pageviews by site. The total percent change displayed at the bottom of the visual is ...
- 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.
Anonymous
10 months agoNot applicable
Hi andrelee ,
Thank you for reaching out to the Microsoft fabric community forum.
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 by KNP . If you still require support, please let us know, we are happy to assist you.
Thank you.