Forum Discussion
Switch Selected Value Errors
- 6 years ago
Anonymous here is the measure provided as solution by email.
Selected Value = var curr_date_rank = min(Sheet3[Date Rank]) var prev_date_rank = (Min(Sheet3[Date Rank]) + 1) var switchvalue = SWITCH( SELECTEDVALUE(Query1[ID]), 1, calculate(sum(Sheet3[Delta]), Sheet3[Date Rank] = curr_date_rank)/10000 , 2, calculate(sum(Sheet3[Delta]), Sheet3[Date Rank] = curr_date_rank)/10000 - calculate(SUM(Sheet3[Delta]), ALL(Sheet3[Date]) ,Sheet3[Date Rank] = prev_date_rank)/10000, 0) return switchvalue
Anonymous I'm not surely if you resolved your issue or still need help.
I am finding that my issue is actually filtering in the visualization. I am filtering using the date column but this seems to be filtering out the values from the previous day, so I am just getting the same value as the sum. I can filter by the date rank column and get the correct values for the difference but I cannot seem to get it to work when using the date column
I have changed my code with the thought that using the date instead of the date rank will yield the correct answer to no avail
Selected Value =
var curr_date_rank = min(NG_POS_MGR[Date Rank])
var prev_date_rank = (Min(NG_POS_MGR[Date Rank]) + 1)
var curr_date = CALCULATE(min(NG_POS_MGR[Date]), NG_POS_MGR[Date Rank] = curr_date_rank)
var prev_date = CALCULATE(min(NG_POS_MGR[Date]), NG_POS_MGR[Date Rank] = prev_date_rank)
var switchvalue =
SWITCH(
SELECTEDVALUE('Toggle Table'[ID])
,1, calculate(sum(NG_POS_MGR[Delta]), NG_POS_MGR[Date] = curr_date)/10000
,2, calculate(sum(NG_POS_MGR[Delta]), NG_POS_MGR[Date] = curr_date)/10000 - calculate(SUM(NG_POS_MGR[Delta]), NG_POS_MGR[Date] = prev_date)/10000
, 0
)
return switchvalue
- parry2k6 years agoSuper User
Anonymous it shoul be straight forward, can you share sample pbix file, you can remove sensitive information before sharing.
- Anonymous6 years agoNot applicable
Sent!
- v-kelly-msft6 years agoCommunity Support
Hi Anonymous ,
Can you upload your .pbix file to onedrive business and share the link with me?
Best Regards,
KellyDid I answer your question? Mark my post as a solution!