Forum Discussion

tkavitha911's avatar
tkavitha911
Helper III
1 year ago
Solved

Pls help this dax calculated column.

MARKETMaxof etaContainer countinbound_capacityout_containers
japan01-02-202425 
japan04-02-202425 
japan05-02-202475 
Korea07-02-2024137 
Korea08-02-202457 
Korea09-02-2024557 
china10-02-2024766 
china11-02-2024986 
china13-02-202476 

calculate each market wise and each day based on inbound capacity container will go out.
if container capacity is 2 and container count is 4 out_containers per day 2 and it will add next day remaining 2 containers,
pls help this dax calculated column

  • v-sgandrathi's avatar
    v-sgandrathi
    1 year ago

    Hi tkavitha911,

     

    Ensure that your table contains the necessary columns with the correct data types. The MARKET column should be in text format, while the Maxof eta (or your actual ETA date column) should be stored as a date. Additionally, the Container count and inbound_capacity columns must be in whole number format to ensure accurate calculations. Properly structuring your data in this way will help avoid errors and ensure smooth data processing in Power BI.

     

    I used the sample data you provided and applied it to my Power BI report to test the calculation logic:

     

    Container Remaining at EOD =

    VAR currentMarket = 'Sheet1'[MARKET]

    VAR currentDate = 'Sheet1'[Maxof eta]

     

    -- Total containers till this date for the same market

    VAR totalContainers =

        CALCULATE(

            SUM('Sheet1'[Container count]),

            FILTER(

                'Sheet1',

                'Sheet1'[MARKET] = currentMarket &&

                'Sheet1'[Maxof eta] <= currentDate

            )

        )

     

    -- Total outbound capacity till this date for same market

    VAR totalCapacity =

        CALCULATE(

            SUM('Sheet1'[inbound_capacity]),

            FILTER(

                'Sheet1',

                'Sheet1'[MARKET] = currentMarket &&

                'Sheet1'[Maxof eta] <= currentDate

            )

        )

     

    RETURN

        MAX(0, totalContainers - totalCapacity)

     

    Glad I could assist! If this answer helped resolve your issue, please mark it as Accept as Solution and give us Kudos to guide others facing the same concern.

     

    Thank you.

     

10 Replies

  • Hi tkavitha911 

    I'm honestly a bit confused by your explanation. Does "container capacity" refer to the inbound capacity? Also, where will the remaining containers be added? Could you kindly provide your expected result using the same dataset you shared, along with a brief explanation of the reasoning behind it?

     

    I don't think this is what you're looking for:

     

     

    • tkavitha911's avatar
      tkavitha911
      Helper III

      Containers will be dispatched based on inbound capacity. If the number of containers exceeds the inbound capacity, the excess will be scheduled for the next day, and this process will repeat.

    • tkavitha911's avatar
      tkavitha911
      Helper III

      Containers will be dispatched based on inbound capacity. If the number of containers exceeds the inbound capacity, the excess will be scheduled for the next day, and this process will repeat.

    • v-sgandrathi's avatar
      v-sgandrathi
      Community Support

      Hi tkavitha911,

      Thank you for the clarification.

      I acknowledge danextian response that their request for the expected output and confirmation of inbound capacity was appropriate and well considered.

       

      Based on your follow-up, we understand that:

      • Inbound capacity is the max number of containers dispatched per day.
      • Any excess containers should roll over to the next day, continuing until cleared.

      To proceed with a DAX solution, could you please share the expected out_containers values for your sample data? This will help validate the logic and ensure an accurate implementation.

      Thank you.

       

      • v-sgandrathi's avatar
        v-sgandrathi
        Community Support

        Hi tkavitha911,

         

        As we did not get a response, may I know if the above reply could clarify your issue, or could you please help confirm if we may help you with anything else?

         

        And if the provided information meets your requirements, you can Accept the solution and also give Kudos on that reply. It helps other users who are searching for this same information and find the information.

         

        Your understanding and patience will be appreciated.