Forum Discussion

nix's avatar
nix
Icon for Helper I rankHelper I
1 year ago
Solved

DAX CALCULATION

 


I am using this calculated column for column 3,actually it should calculate minimum nad date from nad_custome_date for vessel_id wise(i have selected only one vessel here),then it should calculate minimum of 

[startofsailingpassage] per vessel,then  it should compare with minimum nad date,if true then 1 or else 0,so true should come once only rest should false but it is countung for each port wise ,
how to solve this

TIA
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi nix ,

    Based on the testing, please try the following methods:

    1.Create the sample table.

    2.Create the new column to filter the date.

    Column 3 = 
    VAR _MIN_VESAEL = CALCULATE(MIN('Missing Arrival/Depart query'[nad_customer_date]), ALLEXCEPT('Missing Arrival/Depart query', 'Missing Arrival/Depart query'[vessel_id]))
    VAR _startofpassage = CALCULATE(MIN('Missing Arrival/Depart query'[startofpassage]), ALLEXCEPT('Missing Arrival/Depart query', 'Missing Arrival/Depart query'[vessel_id]))
    RETURN
    IF('Missing Arrival/Depart query'[nad_customer_date] = _MIN_VESAEL && _MIN_VESAEL = _startofpassage && 'Missing Arrival/Depart query'[nad_type] = 59, 1, 0)
    

    3.The result is shown below.

    Best Regards,

    Wisdom Wu

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

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nix ,

    Based on the testing, please try the following methods:

    1.Create the sample table.

    2.Create the new column to filter the date.

    Column 3 = 
    VAR _MIN_VESAEL = CALCULATE(MIN('Missing Arrival/Depart query'[nad_customer_date]), ALLEXCEPT('Missing Arrival/Depart query', 'Missing Arrival/Depart query'[vessel_id]))
    VAR _startofpassage = CALCULATE(MIN('Missing Arrival/Depart query'[startofpassage]), ALLEXCEPT('Missing Arrival/Depart query', 'Missing Arrival/Depart query'[vessel_id]))
    RETURN
    IF('Missing Arrival/Depart query'[nad_customer_date] = _MIN_VESAEL && _MIN_VESAEL = _startofpassage && 'Missing Arrival/Depart query'[nad_type] = 59, 1, 0)
    

    3.The result is shown below.

    Best Regards,

    Wisdom Wu

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

     

  • could you pls provide some sample data (not the screenshot) and the expected output?