Forum Discussion
Different calculations for same visual
I'm trying to get different results when a shift is selected and when no shifts are selected.
If shift = 1 or 2 then "Available" -12
If shift is blank, then "Available" - 24.
I was able to get it to work when selecting either 1 or 2 using "Difference = Sum('Combined Ops'[Total Time Available]) - 12"
But when niether shift is selected, I need for the difference to be Available - 24. This is what I'm getting:
Hi Anonymous ,
SELECTEDVALUE function is apt for this one.selectedvalue gives blank when nothing is selected or more than one value is selected.we can customizeour output based on the outcome of selected value
try below measure:
Difference = IF( ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])), Sum('Combined Ops'[Total Time Available])-24, Sum('Combined Ops'[Total Time Available])-12 )Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
Hi Anonymous ,
when you have two conditions ,USE IF expression.
when you have more than two conditions,use SWITCH expression.
something like below should work.do the ordering of conditions as per your requirements.
Difference = SWITCH(TRUE(), ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])),Sum('Combined Ops'[Total Time Available])-120, //condition 1 ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])),Sum('Combined Ops'[Total Time Available])-24,//condition 2 Sum('Combined Ops'[Total Time Available])-12 //else part )Thanks and Regards,
Praful
9 Replies
- samratpbiSuper User
Hi Anonymous , I dont have your dataset, hence cant calculate Sum('Combined Ops'[Total Time Available]) , however if you use the below measure, it should resolve your problem.
I created a measure like below:
Difference =IF(ISFILTERED(AllSeasons[SessionTitle]),20 - 12,20 - 24)here replace AllSeasons[SessionTitle] with your Shift column and 20 with your SUM calculation. Idea is when Shift column is filtered when -12, otherwise -24.below is output:when nothing selectedwhen a value selected:
Hope this helps to resolve your problem.
If it does, then mark it as solution.
Thanks - Samrat
- Praful_PotphodeSuper User
Hi Anonymous ,
SELECTEDVALUE function is apt for this one.selectedvalue gives blank when nothing is selected or more than one value is selected.we can customizeour output based on the outcome of selected value
try below measure:
Difference = IF( ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])), Sum('Combined Ops'[Total Time Available])-24, Sum('Combined Ops'[Total Time Available])-12 )Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
- AnonymousNot applicable
Thank you so much. That worked perfect.
- AnonymousNot applicable
I have a new request. I need a calculation that incorporates the above solution but can aslo process the below:
Difference6 = IF(ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])),SUM('Combined Ops'[Automatic])-120)
Can this be done?- Praful_PotphodeSuper User
Hi Anonymous ,
when you have two conditions ,USE IF expression.
when you have more than two conditions,use SWITCH expression.
something like below should work.do the ordering of conditions as per your requirements.
Difference = SWITCH(TRUE(), ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])),Sum('Combined Ops'[Total Time Available])-120, //condition 1 ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])),Sum('Combined Ops'[Total Time Available])-24,//condition 2 Sum('Combined Ops'[Total Time Available])-12 //else part )Thanks and Regards,
Praful