Need help tying a couple of lines together

Greetings Folks,
I am trying to get a working measure and am losing the train somewhere.

I want to pipe out profit by Expected close date on a bunch of vendors but when a vendor called “Atlassian” comes up I want that measure "Profit by Expected Close Date " to be divided by 2

I would really appreciate any help offered.

Sum(
Descendants([vendor].CurrentMember, [vendor].[vendor]),
CASE WHEN [Vendor].CurrentMember.Name = ‘Obsidian Code- Infrastructure’ OR
[vendor].CurrentMember.Name = ‘Obsidian Code- Automation’ OR
[Vendor].CurrentMember.Name = ‘Obsidian Outsourcing’ OR
[Vendor].CurrentMember.Name = ‘Obsidian Data’ OR
[Vendor].CurrentMember.Name = ‘Obsidian Teams’ OR
[Vendor].CurrentMember.Name = ‘Obsidian Managed Services’ OR
[Vendor].CurrentMember.Name = ‘Obsidian Compute’
AND
[Vendor].CurrentMember.Name = ‘Atlassian’
THEN
[Measures].[Profit by Expected Close date] /2
ELSE
[Measures].[Profit by Expected Close date]
END
)

Hi @Dean1,

The general approach for the calculation looks right. But seems there is some mismatch with logic and how to use OR and AND operands for conditions.

Using CASE WHEN /THEN statement you may list numerous conditions with WHEN / THEN. The last branch ELSE is optional and used to declare how to behave for conditions not listed. The structure looks like this:

CASE
  WHEN condition a THEN measure A
  WHEN condition b THEN measure B
  WHEN condition c THEN measure C
  ..
  ELSE measure 4 --this line is optional
END

There are described more details on conditions: https://docs.eazybi.com/eazybijira/analyze-and-visualize/calculated-measures-and-members/calculated-measures#Calculatedmeasures-Conditions

Unfortunately, I didn’t understand the exact logic of what the calculation should do for your report. Howevere, there are two examples with comments on how you may write the condition part. Probably those comments will clarify the logic and will help you to construct the formula you are looking for if I haven’t guessed your use case exactly.

  1. For all listed vendors apply profit value divided by two and for the rest of the vendors get full profit value

    Sum(
      --set of all vendors
      Descendants([Vendor].CurrentMember, [Vendor].[Vendor]),
      CASE WHEN --for listed vendors get profit dived by two
        [Vendor].CurrentMember.Name = 'Obsidian Code- Infrastructure' OR
        [Vendor].CurrentMember.Name = 'Obsidian Code- Automation' OR
        [Vendor].CurrentMember.Name = 'Obsidian Outsourcing' OR
        [Vendor].CurrentMember.Name = 'Obsidian Data' OR
        [Vendor].CurrentMember.Name = 'Obsidian Teams' OR
        [Vendor].CurrentMember.Name = 'Obsidian Managed Services' OR
        [Vendor].CurrentMember.Name = 'Obsidian Compute' OR
        [Vendor].CurrentMember.Name = 'Atlassian'
      THEN
        [Measures].[Profit by Expected Close date] /2
      ELSE -- for the rest of vendors get full profit
       [Measures].[Profit by Expected Close date]
      END
    )
    
  2. For listed vendors get profit value divide by two and for Atlassian get full profit value.

    Sum(
      --set of all vendors
      Descendants([Vendor].CurrentMember, [Vendor].[Vendor]),
      CASE WHEN --for listed vendors get profit dived by two
        [Vendor].CurrentMember.Name = 'Obsidian Code- Infrastructure' OR
        [Vendor].CurrentMember.Name = 'Obsidian Code- Automation' OR
        [Vendor].CurrentMember.Name = 'Obsidian Outsourcing' OR
        [Vendor].CurrentMember.Name = 'Obsidian Data' OR
        [Vendor].CurrentMember.Name = 'Obsidian Teams' OR
        [Vendor].CurrentMember.Name = 'Obsidian Managed Services' OR
        [Vendor].CurrentMember.Name = 'Obsidian Compute'
      THEN 
        [Measures].[Profit by Expected Close date] /2
      WHEN --vendor is Atlassian get full profit value
        [Vendor].CurrentMember.Name = 'Atlassian'
      THEN 
        [Measures].[Profit by Expected Close date]
      END
    )
    

Best,
Zane / support@eazyBI.com