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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Jack2of3
Helper II
Helper II

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:
 

 

1 ACCEPTED SOLUTION
Jack2of3
Helper II
Helper II

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

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Jack2of3 ,Does the above reply helps. if you need more help make me @

Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Jack2of3
Helper II
Helper II

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

amitchandak
Super User
Super User

@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.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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