1
votes

Im trying to sum something using calculate but can't really figure out how.

For example

  ID   Value   Source  
 ---- ------- -------- 
  A        1   Mo      
  B        2   Ba      
  A        1   Ba      
  C        3   Mo      
  B        2   Mo      
  D        4   Ba  

What i'm trying to calculate is not to filter out either source but to take either one source. For example, if I have ID: A and both Source Mo & Ba, then pick either one for the sum and not both. Would this be possible using calculate? I thought of

Measure1 = CALCULATE(SUM(Table1),SWITCH(Table1[Source],"Mo",Table1[Value],"Ba",Table1[Value]))

(It didn't work)

Thanks in advance!

1
How do you choose which one do you want?Alexis Olson
It's either one, because it has the same value. Do you think i can apply a filter or something? Like Distinct?Swords_Plowshare
If you need one value, use min or max instead of sum.Andrey Nikolov
Ohhhh! True that!! Thanks guys!Swords_Plowshare

1 Answers

0
votes

You should be able to use a simple filter like this:

Measure1 = CALCULATE(SUM(Table1), Table1[Source] = "Mo")

Another possibility would be to simply filter out one or the other at the report/page/visual level.