Forum Discussion
Different calculations for same visual
- 9 months ago
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
- 8 months ago
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
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
I have a new request. I need a calculation that incorporates the above solution but can aslo process the below:
Can this be done?
- Praful_Potphode8 months agoSuper 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
- Anonymous8 months agoNot applicable
This works great. Thank you so much.
- Anonymous8 months agoNot applicable
I don't mean to nickel and dime this formula, but I also need a requirement that allows for the following:
If Machine is blank and either shift is selected, then Total Time - 60.
Just to be clear, These are the requirements for the formula.
1 - Machine blank and shift blank = total -120
2 - Machine blank and shift selected = total -60
3 - Machine select and shift blank = Total -24
4 - Machine selected and shift selected = total -12I tried modifying your formula, but have been unsuccesful.
Thank you in advance for your help.
- Praful_Potphode8 months agoSuper User
Anonymous
please try below:
Difference = SWITCH(TRUE(), ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])) && ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])),Sum('Combined Ops'[Total Time Available])-120, //condition 1 ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])) && not ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])),Sum('Combined Ops'[Total Time Available])-60, //condition 2 not ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])) && ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])),Sum('Combined Ops'[Total Time Available])-24, //condition 3 not ISBLANK(SELECTEDVALUE('Combined Ops'[Machine Name])) && not ISBLANK(SELECTEDVALUE('Combined Ops'[Shift])),Sum('Combined Ops'[Total Time Available])-12, //condition 4 )Please give kudos if it works.
Thanks and Regards,
Praful