Forum Discussion

vinodDrinkPak's avatar
vinodDrinkPak
Helper II
2 years ago

Rolling outbound DAX Issue

hi Experts amitchandak 

below is my line graph and the blue one is creating issue

and for the same i have the measure

 

Rolling Outbound =
VAR CD = MAXX(ALLSELECTED('OutbundDates(Disconnected)M'), 'OutbundDates(Disconnected)M'[End of Month])
VAR SD = EOMONTH(CD, -6) + 1
VAR Result = CALCULATE(
    DISTINCTCOUNT(SHIPPING_CONTAINER[CONTAINER_ID]),
    FILTER(
        ALL(SHIPPING_CONTAINER),
        SHIPPING_CONTAINER[End of Month] >= SD && SHIPPING_CONTAINER[End of Month] <= CD
    ),
    USERELATIONSHIP(SHIPPING_CONTAINER[End of Month], 'OutbundDates(Disconnected)M'[End of Month])
)
RETURN Result

 

please note that SHIPPING_CONTAINER[End of Month] and  'OutbundDates(Disconnected)M'[End of Month] has not active relationship, as i cannot create a physical relationship like one to many, i have used  Userrelationship function

may be something wrong in how i am doing it? please help

 

outbound EOM is working fine, here is how the dax is created

 

OutboundEOM =
VAR __END_DATE =
    MAXX(ALLSELECTED('OutbundDates(Disconnected)M'),  'OutbundDates(Disconnected)M'[End of Month])
VAR __START_DATE =
    EOMONTH(__END_DATE,-6)+1
RETURN
    CALCULATE (
        DISTINCTCOUNT (SHIPPING_CONTAINER[CONTAINER_ID] ),
        FILTER (
            SHIPPING_CONTAINER,
            SHIPPING_CONTAINER[End of Month] >= __START_DATE
                && SHIPPING_CONTAINER[End of Month] <= __END_DATE
        )
    )

1 Reply