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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
janislv
Helper I
Helper I

How to get the earliest date when table is a variable?

I'm trying to get a single date value that would be used as a reference for further calculations. So far I have the correct result for first date when [value_Y] >= 8, but I need this on all other dates as well. This looks so simple that I have a feeling about missing some fundamental rule.

 

Measure_Z =
VAR table_x =
    FILTER (
        ADDCOLUMNS ( VALUES ( 'Calendar'[Date].[Date] ), "value_Y", [Measure_Y] ),
        [value_Y] >= 8
    )
RETURN
    MINX ( table_x, 'Calendar'[Date].[Date] )

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @janislv ,

According to your description, I create a sample. By your Measure_Z formula, get the result like yours', I'm not sure your expected result is like MeasureZ1 or MeasureZ2. 

vkalyjmsft_0-1645085907134.png

Here's the foumula for the two situation.

MeasureZ1 =
MINX (
    FILTER ( ALL ( 'Calendar' ), 'Calendar'[Measure_Y] >= 8 ),
    'Calendar'[Date]
)
MeasureZ2 = 
VAR _MIN =
    MINX (
        FILTER ( ALL ( 'Calendar' ), 'Calendar'[Measure_Y] >= 8 ),
        'Calendar'[Date]
    )
RETURN
    IF ( MAX ( 'Calendar'[Date] ) = _MIN, _MIN, BLANK () )

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @janislv ,

According to your description, I create a sample. By your Measure_Z formula, get the result like yours', I'm not sure your expected result is like MeasureZ1 or MeasureZ2. 

vkalyjmsft_0-1645085907134.png

Here's the foumula for the two situation.

MeasureZ1 =
MINX (
    FILTER ( ALL ( 'Calendar' ), 'Calendar'[Measure_Y] >= 8 ),
    'Calendar'[Date]
)
MeasureZ2 = 
VAR _MIN =
    MINX (
        FILTER ( ALL ( 'Calendar' ), 'Calendar'[Measure_Y] >= 8 ),
        'Calendar'[Date]
    )
RETURN
    IF ( MAX ( 'Calendar'[Date] ) = _MIN, _MIN, BLANK () )

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

amitchandak
Super User
Super User

@janislv , try like

 

Measure_Z =
VAR table_x =
FILTER (
ADDCOLUMNS ( Summarize ( 'Calendar'[Date] ), "value_Y", [Measure_Y] ),
[value_Y] >= 8
)
RETURN
MINX ( table_x, 'table_x'[Date] )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

This is the result I got. Measure_Y is a rolling average of Measure_A. So in this case condition [value_Y] >= 8 refers to Measure_A.

 

 

bezvalues.png

 

After adding VALUES ( 'Calendar'[Date].[Date] ), the condition [value_Y] >= 8 refers to Measure_Y, as it should be.

 

values.png

Nope, this looks the same as my first guess (before adding VALUES()):

Measure_Z =
VAR table_x =
    FILTER (
        ADDCOLUMNS ( 'Calendar', "value_Y", [Measure_Y] ),
        [value_Y] >= 8
    )
RETURN
    MINX ( table_x, 'Calendar'[Date] )

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.