Issue when using IFS expression

I have an issue when trying to use the IFS expression to perform calculations using the Order Capture Sample app. The expression to calculate totals on the Order Details table is as follows: [Product Id].[Price] * [Quantity]. This expression is used for all products. However, I am trying to customize the app so that each product has a unique calculation. When I enter the following expression: IFS([Product Id]=“Strawberry”,[Product Id].[Price][Quantity].02,[Product Id]=“Kiwi”,[Product Id].[Price] * [Quantity] * .05,[Product Id]=“Raspberry”,[Product Id].[Price] * [Quantity] * .2) the Total disappears from the UX and no total is calculated. Any Suggestions?

Try setting a default case IE IFS(Exp1,Result1,Exp2,Result2,true,“Default”)
This will tell you if the problem is in your Exp statements or in the formulas. If it doesn’t make it to the Default then your Result expressions are giving the error and if you make it to the Default then the Exp statements are wrong.

1 Like

I set the default and the Total was instantly filled in with my default case. It appears that the Total switched to requiring a user input instead of making a calculation.

My guess is that your Product Name is not the same as your Product Id. Try using something like this:

[Product Id].[Product Name]=“Strawberry”

1 Like

I made the change to Product Name and had no success. If I use a simple formula that does not include the IFS, then it works fine. The issue occurs when using the IFS expression.

Let’s get some screenshots of your data.

1 Like

Precede all decimal points with a 0 (e.g., .02 should be 0.02).

I placed the zero in front of my decimals. The issue still exists. If I use a simple IF expression, the calculation takes place and the column is completed. If I use an IFS expression, the calculation does not take place and the “Total” column is not completed. I am using the sample app “Order Capture.” Could the issue be caused by the Ref_Rows expressions or the virtual columns?

Please post screenshots of the working expression and the non-working expression.

1 Like

I actually just figured it out. I was using an incorrect reference.

2 Likes