Forum Discussion

my2girls's avatar
my2girls
New Member
4 years ago

Tableau To DAX

Hi All. I have worked on Tableau for a while but my company is migrating to Power BI and i am new to the enviroment. My question is, i have calculated field (below)

 

if sum([Total Value]) >=0
and sum([Total Value]) < 250000
then 'Under $250'
ELSEIF
sum([Total Value]) >= 250000
AND sum([Total Value]) <= 5000000
THEN '$250k and $5M'
ELSEIF
sum([Total Value]) > 5000000
AND sum([Total Value]) <= 10000000
THEN '$5M to $10M'
ELSE 'Over $10M' end

 

and i tried the below DAX and it is not working

 

dollar Value = calculate(sum(Table[Total Value]) >=0 ,
Table[Total Value] <  250000 = "Under $250",
or(Table[Total Value] >=  250000,
 AND(Table[Total Value] <= 5000000 = "$250k and $5M",
or(Table[Total Value] >  5000000,
AND(Table[Total Value] <=  10000000 = "$5M to $10M",
(  "Over $10M" ))))))
 
Need help. Thanks

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    my2girls I would do something like:

     

    New Column or Measure =
      VAR __Sum = SUM('Table'[Total Value])
    RETURN
      SWITCH(TRUE(),
        __Sum >=0 && __Sum < 250000, "Under $250",
        __Sum >= 250000 && __Sum <= 5000000, "$250K and $5M",
        __Sum >= 5000000 && __Sum <= 10000000, "$5M to $10M",
        "Over $10M"
      )