Forum Discussion

TungNguyen_19's avatar
TungNguyen_19
Icon for Helper III rankHelper III
3 years ago

How to make conditional formula on mixed type column?

Hello everyone,

I have the column with data like this:

 

Charge 
3509
4400
No Charge
6000

I want to make the calculated column with the formula like this:

 

IF([Charge] =" No Charge", 0, IF([Charge]>500, [Charge]/24,[Charge]))

 

But the type of the Charge column is Text so the formula can not be done, please help me. 

Thank you ❤️

3 Replies

  • Hi TungNguyen_19 ,

     

    On the query editor you can do the following code:

    if [#"Charge "] = "No Charge" then 0 else
    if  Number.FromText ([#"Charge "]) > 50 then Number.FromText([#"Charge "]) / 24 else Number.FromText([#"Charge "])

     

    • TungNguyen_19's avatar
      TungNguyen_19
      Icon for Helper III rankHelper III

      Hi MFelix 

      Is there any way to do this in DAX? Because the table come from database and I don't have credential to modify it on Power Query. So I'm only can work around in Power Desktop by using DAX.

      Thank you ❤️