Forum Discussion

Jack2of3's avatar
Jack2of3
Icon for Helper II rankHelper II
5 years ago
Solved

CALCULATE MIN WHEN DATE IS NOT EMPTY

Data has multiple field 1 text values that are duplicated in some cases and field 1 is always populated.

Data has multiple field 2 date values that are populated sometimes for field1 when duplicated or not.

I figured out how to get the first occurance of the field 2 date for each field 1 when all the Field 1 rows have field 2 dates.

What I need to do is not have the MIN(Field2 Date =EMPTY be included in the Calculation when the Fields 2 date for the same field 1 value is populated AND if all the field 2 date values are EMPTY for a given field 1 value to select 1 of the EMPTY field 2 rows

Current formula:

First_date =
VAR _POLDate =
CALCULATE (
MIN ( PO_REQ_DISTRIBUTION[PO_LINE_CREATED_DATE]),
ALLEXCEPT ( PO_REQ_DISTRIBUTION,PO_REQ_DISTRIBUTION[PO_NUMBER] )
)
RETURN
IF(PO_REQ_DISTRIBUTION[PO_LINE_CREATED_DATE] = _POLDate, "1", "0")
 
The issue is it shows the first EMPTY date instead of the populated date:
 

 

  • Appreciate the suggested solution.

    I ended up changing the qualifier to the IDV Num instead of the PO_NUMBER as the IDV Number was the same for multiple PO_Numbers

3 Replies

  • Jack2of3 , Try like

    Current formula:
    First_date =
    VAR _POLDate =
    CALCULATE (
    firstnonblank ( PO_REQ_DISTRIBUTION[PO_LINE_CREATED_DATE], blank()),
    ALLEXCEPT ( PO_REQ_DISTRIBUTION,PO_REQ_DISTRIBUTION[PO_NUMBER] )
    )
    RETURN
    IF(PO_REQ_DISTRIBUTION[PO_LINE_CREATED_DATE] = _POLDate, "1", "0")

     

    if not resolved

    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

  • Appreciate the suggested solution.

    I ended up changing the qualifier to the IDV Num instead of the PO_NUMBER as the IDV Number was the same for multiple PO_Numbers