Nested IF function not generating correct values when trying to return absolute values in Power Pivot. Help!

bsm818

New Member
Joined
Aug 25, 2021
Messages
1
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello everyone! I work for a merchandising company, and I am working on generating a report that summarizes the total amount of product movement that has occured from an old shelf planogram to a new shelf planogram.

I am working with two fact tables (APOLLO XPOS 1 and 2) that reflect the most recent planogram information and the prior, and two dimension tables containing Planogram ID#'s (APOLLO VPOG ID) and item information (IM) as seen below;

1629989846919.png



Essentially, what I am trying to calculate is any changes in both shelf an item is placed on, and the X-postion of the item along the horizontal axis of each shelf.

I have created SUM measures to total both the previous and new values for LINEAR (which is how many inches and item is using), XPOS (the x-position of the item) and a MAX measure of shelf (to summarize how many shelves are in a planogram), along with a measure to calculate the footprint width of a planogram which can be used to derive linear footage (For example, a 3 foot planogram with 9 shelves would equate to 27 feet of liner space within a planogram). These are pictured below;


1629990394279.png
1629990464652.png


The logic I am trying to move forward with is to subtract PREVIOUS XPOS from NEW XPOS to calculate the change in XPOS, and if the result if a negative number, return the value as a positive (because you can't have a negative amount of change in space). It gets complicated here when dealing with items that have either been removed or added between planogram versions, which I utilized nested IF functions to return BLANK if there are blanks in either NEW or PREVIOUS XPOS columns;

1629990882103.png


This measure accounts for the blanks correctly, but it is incorrectly calculating items that have a NEW XPOS of "0" that have a PREVIOUS XPOS larger than "0";

1629991098491.png


These items essentially moved from a 31 and 26.26 inches along the X-axis of their respective shelves, to 0 (which equates to the beginning of the shelf), which should produce a change value of 31 and 26.26 respecitvely, but they are generating blanks.

Is there a problem being caused here by nesting too many IF functions in the measure? Is there a better measure to utilize to accomplish this calculation?


Thnaks to anyone who is able to help! I hope I was able to effectively explain what I am trying to accomplish here. :)
 

Attachments

  • 1629990438484.png
    1629990438484.png
    32.8 KB · Views: 10

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi BSM
it may be that the formula is interpreting a 0 as blank, it shouldn't but hey computers can do strange things. There's a handy think in excel, formula bar - evaluate formula that is useful for debugging, can highlight when the data is not being interpreted as expected.
An option for simplification for your formula:
if(and(isnumber([PREVIOUS XPOS]),isnumber(NEW XPOS)),ABS([NEW XPOS]-[PREVIOUS XPOS]),"")

The number of if's in your formula should be OK, I think there is a limit but it's more than that. The above will work in excel, may need some changes for power pivot, sorry haven't used power pivot.

Also, when I'm finding a formula not doing as I expect, I will do each part of it in it's own column, like a manual version of the evaluate formula function.
 
Upvote 0

Forum statistics

Threads
1,214,829
Messages
6,121,827
Members
449,051
Latest member
excelquestion515

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top