Forum Discussion

GraceTCL's avatar
GraceTCL
Helper II
5 years ago
Solved

Error - Switch function does not support comparing values of type Text with values of type Integer.

Can anyone help with above error message in below code:

 

Segment Inflow% vs GF =
Var Adjusted_Order_Value_USD = ([GF_ALL_AOV_USD_Measure])*([Order_count_measure])
Var Adjusted_GMV_USD = (Adjusted_Order_Value_USD-[Order_Value_without_MFC_USD_Measure]+[GMV_USD_measure])
Var AOV_Impact = ((([Order_Value_without_MFC_USD_Measure]-Adjusted_Order_Value_USD)*[Commission%_Measure])/Adjusted_GMV_USD)
Var Comms_Impact = ((([Commission%_Measure]-[GF_ALL_Commission%])*Adjusted_Order_Value_USD)/Adjusted_GMV_USD)
Var SOF_Impact = ((([SOF_Per_Order_USD]-[GF_ALL_SOF_Per_Order_USD])*[Order_count_measure])/Adjusted_GMV_USD)
Var PF_Impact = ((([PF_Per_Order_USD]-[GF_ALL_SOF_Per_Order_USD])*[Order_count_measure])/Adjusted_GMV_USD)
Var Dax_Costs_Impact = ((([Dax_Costs_Per_Order_USD]-[GF_ALL_Dax_Costs_Per_Order_USD])*[Order_count_measure])/Adjusted_GMV_USD)
Var Del_Fee_Impact = ((([Del_Fee_Per_Order_USD]-[GF_ALL_Del_Fee_Per_Order_USD])*[Order_count_measure])/Adjusted_GMV_USD)
Var Promo_Costs_Impact = ((([Promo_Costs_Per_Order_USD]-[GF_ALL_Promo_Costs_Per_Order_USD])*[Order_count_measure])/Adjusted_GMV_USD)
Var AOV_and_Comms_Mix_Impact = ([Net_inflow_%GMV]-[Order_Value_%GMV]-[Commission_%GMV]-[SOF_%GMV]-[PF_%GMV]-[Dax_Costs_%GMV]-[Del_Fee_%GMV]-[Promo_Costs_%GMV])

Return
Switch(SELECTEDVALUE('Inflow Category'[Category]),
1,
Switch(SELECTEDVALUE(Inflow_Breakdown[Breakdwon]),
"AOV",-1*AOV_Impact,
"Commission Rate",-1*Comms_Impact,
"AOV/Comms Mix",-1*AOV_and_Comms_Mix_Impact,
"SOF",-1*SOF_Impact,
"PF",-1*PF_Impact,
"Dax Costs",-1*Dax_Costs_Impact,
"Del Fee",-1*Del_Fee_Impact,
"Promo Costs",-1*Promo_Costs_Impact,
[GF_ALL_Inflow_%GMV]
),
2,
Switch(SELECTEDVALUE(Inflow_Breakdown[Breakdwon]),
"AOV", 0,
"Commission Rate", 0,
"AOV/Comms Mix", 0,
"SOF", 0,
"PF", 0,
"Dax Costs", 0,
"Del Fee", 0,
"Promo Costs", 0,
[Net_inflow_%GMV]
)
)
  • You are telling switch to check for 1 in the [Category] column.  There is no 1 in the [Category] column.  You either need to have switch look for "Platform Inflow" in the [Category] column or look for 1 in the [CategorySort] column.

6 Replies

  • My guess is your problem is here.
    SELECTEDVALUE ( 'Inflow Category'[Category] )1,

    What are the values in the 'Inflow Category'[Category] column becuase the measure is checking if is = 1

    If it is 1 maybe it is stored a text in the model? try it with SELECTEDVALUE ( 'Inflow Category'[Category] ), "1",

     

    • GraceTCL's avatar
      GraceTCL
      Helper II

      Hi jdbuchanan71 Thanks for your reply!

      Unfortunately it still doesnt work after I tried with 'SELECTEDVALUE ( 'Inflow Category'[Category] ), "1",".

      The values in my table are in the screenshot.

      Could it be because I return no values for some of my divide functions as numerator or denominator may be zero? If so, how do I correct that?

      If this is not the reason, pls still advise. Thanks!

       

       

       

       

      • jdbuchanan71's avatar
        jdbuchanan71
        Super User

        Can you share what your 'Inflow Category'[Category] table looks like?  Your switch is saying look for a 1 in the [Category] column.  What are the values in the [Category] column?

  • Is Category[CategorySort] a number or text, in your formula you are checking it one way first then the other way.