Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
GraceTCL
Helper II
Helper II

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]
)
)
1 ACCEPTED SOLUTION

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.
2021-04-18_22-14-22.png

View solution in original post

6 REPLIES 6
jdbuchanan71
Super User
Super User

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

jdbuchanan71_0-1618837201247.png

 

jdbuchanan71
Super User
Super User

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

jdbuchanan71_0-1618760181775.png

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

 

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!

 

 

 

 

Inflow Breakdown.PNG

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?

Inflow category.PNG

Opps I forgot to upload the category table. Here is it. There is 1 in the Category table.

Essentially I am trying to build a waterfall chart where the start point is "platform inflow %" and the end point is "segment inflow %"

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.
2021-04-18_22-14-22.png

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.