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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
tkavitha911
Helper III
Helper III

Need Urgent Help to fix this dax measure

Hi Team

I need your help to calculate the PD Date using the following logic:

  1. For each day:

    • If the total number of containers for that day is more than the allowed capacity, then:
      • PD Date = Max ETA + Clearance Days + 1
    • If it's within the capacity, then:
      • PD Date = Max ETA + Clearance Days
  2. This check should continue daily, and also consider:

    • If the containers left from the previous day plus today’s containers are more than the capacity, then:
      • PD Date = Max ETA + Clearance Days + 1
    • Otherwise:
      • PD Date = Max ETA + Clearance Days

Could you please help me apply this logic and get the correct PD Dates?

 

 

1 ACCEPTED SOLUTION

hi @tkavitha911 ,

 

not sure if i really get you, try to add a calculated column like:

PD Date  = 
VAR _leftover =
SUMX(
    FILTER(
        data,
        data[markets] = EARLIER(data[markets])
            &&data[max of eta] < EARLIER(data[max of eta])
    ),
    [count of container number] - [Capacity]
)
VAR _result =
IF(
    _leftover+[count of container number] > [capacity],
    [max of eta] + [clearence days]+1,
    [max of eta] + [clearence days]
)
RETURN _result

 

it worked like:

FreemanZ_0-1748593702735.png

 

View solution in original post

2 REPLIES 2
tkavitha911
Helper III
Helper III

MarketsSupply CategoryMax of ETACount of Container NumberCapacityClearence days
China02 MTO01-01-2025 00:00183
China01 SMR06-01-2025 00:001183
China01 SMR07-01-2025 00:001283
China02 MTO07-01-2025 00:001083
China01 SMR10-01-2025 00:002783
China02 MTO10-01-2025 00:00283
China01 SMR13-01-2025 00:00183
China01 SMR14-01-2025 00:00683
China01 SMR18-01-2025 00:001083
Australia01 SMR01-01-2025 00:00163
Australia01 SMR02-01-2025 00:006463
Australia01 SMR03-01-2025 00:00163
Australia01 SMR05-01-2025 00:00263
Australia01 SMR08-02-2025 00:003763
Australia01 SMR09-02-2025 00:00163
Australia01 SMR10-02-2025 00:00163
Australia01 SMR11-02-2025 00:00263
Australia01 SMR12-02-2025 00:00263
Australia01 SMR14-02-2025 00:00763
Japan02 MTO23-01-2025 00:002324
Japan01 SMR24-01-2025 00:00324
Japan01 SMR25-01-2025 00:00124
Japan02 MTO25-01-2025 00:00424
Japan02 MTO26-01-2025 00:00124
Japan02 MTO27-01-2025 00:00124
Japan01 SMR30-01-2025 00:00124
Japan02 MTO31-01-2025 00:00124
Japan02 MTO02-02-2025 00:00524
Korea01 SMR31-01-2025 00:004103
Korea02 MTO01-02-2025 00:0010103
Korea01 SMR03-02-2025 00:005103
Korea02 MTO03-02-2025 00:001103
Korea02 MTO07-02-2025 00:001103
Korea02 MTO11-02-2025 00:005103
Korea01 SMR28-02-2025 00:003103
Australia02 MTO06-01-2025 00:00163

hi @tkavitha911 ,

 

not sure if i really get you, try to add a calculated column like:

PD Date  = 
VAR _leftover =
SUMX(
    FILTER(
        data,
        data[markets] = EARLIER(data[markets])
            &&data[max of eta] < EARLIER(data[max of eta])
    ),
    [count of container number] - [Capacity]
)
VAR _result =
IF(
    _leftover+[count of container number] > [capacity],
    [max of eta] + [clearence days]+1,
    [max of eta] + [clearence days]
)
RETURN _result

 

it worked like:

FreemanZ_0-1748593702735.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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