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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
gjohnston2
Regular Visitor

Issue with something similar to Running Total

I have a unique request.  Here is the base setup - I have several sales order lines, each with a weight ordered amount for a particular product.  I also have a limited amount of available inventory to fill these orders.  Using predefined allocation rules I need to determine how many of these lines can be filled and apply conditional formatting to the lines in my table.  Green lines are those lines which can be filled and yellow for thise that can't be filled.  I have considered using a running total like scenario but can't build that logic.  Any thoughts and/or suggestions would be GREATLY appreciated!!

6 REPLIES 6
gjohnston2
Regular Visitor

gjohnston2_0-1647291181796.png

 

Hi, @gjohnston2 

 

You can try the following methods.

Measure = 
IF (
    CALCULATE (
        SUM ( Sales[Qty] ),
        FILTER ( ALL ( Sales ), [Qty] >= MAX ( Sales[Qty] ) )
    )
        < SELECTEDVALUE ( 'Available Inventory'[Weight] ),
    "Green",
    "Yellow"
)

Then apply Measure to the background color of each column in the conditional format.

vzhangti_3-1647423003146.pngvzhangti_2-1647422956439.png

The results are shown in the figure.

vzhangti_5-1647423079749.png

Is this the result you were expecting?

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks - unfortunately this isn't going to work.  The Qty is a 2 part calculation.  The available amount is a static number based on what is currently in inventory and the Needed Weight by Max Date is based on a selected date.  We have to use the Weight Needed by Max Date compared to the available inventory.
Part 1
Total Weight Needed:=Calculate(SUM('Sales Order Lines'[Lbs Ordered]),'Sales Order Lines'[Open to Fill] = 1)

Part 2
Weight Needed by Max Date:=
Calculate(Total Weight Needed],
       Filter(
       All('Date')
       'Date'[Date] <= MAX('Date'[Date])
       && 'Date'[Date]
              >=MAX('Date'[Date])-90
))

 

I tried to reproduce your solution and got an error - here is what I tried and the error I got

Can Be Filled =

IF(

Calculate(Weight Needed by Max Date],

      FILTER( ALL ('Sales Order Lines',[Weight Needed by Max Date] >= MAX ('Sales Order Lines'[Weight
      Needed by Max Date]))

)

      < SELECTEDVALUE(Available Inventory'[Weight],

      "Green",

      "Yellow"

)

 

I get this error

gjohnston2_0-1647448823649.png

 

gjohnston2
Regular Visitor

Sorry - no colors came through - Happy Customer line should be green and the other 2 should be yellow.

gjohnston2
Regular Visitor

Max Sales Order Date :3/15/2022 We are looking at any orders with line items that need to be filled before on an this date
        
        
Available Inventory  This is a list of available invnetory
ItemWeight      
ABCD5,500.00      
        
        
Current Demand  This is a list of Sales Orders with demand for the above item.  Green indicates it can be filled, Yellow indicates it can't be filled
Sales Order NumberCustomerItemRequested Ship DateQty  
SO12345Happy CustomerABCD3/14/20225000  
SO12346Not HappyABCD3/15/20221000  
SO12347Not HappyABCD3/15/2022750  
v-zhangti
Community Support
Community Support

Hi, @gjohnston2 

 

Is it possible to provide some of the example data? And what do you expect the output to look like?

 

Best Regards

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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