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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PatBen
New Member

Embed a MIN function in the filter of a CALCULATE function

Hello, I am new to DAX.

 

I created a quick measure that works well (see Measure 1, below).

 

Measure 1 =

VAR __BASELINE_VALUE = CALCULATE(SUM('H_CASC'[VALUE]); 'H_W'[VALUE] IN {50})

VAR __MEASURE_VALUE = SUM('H_CASC'[VALUE])

RETURN

 

Now, I would like to modify this measure 1 by replacing the static value in the filter (see the expression in red below) by a dynamic min expression (see Measure 2 below).

 

Measure 1 =

VAR __BASELINE_VALUE = CALCULATE(SUM('H_CASC'[VALUE]); 'H_W'[VALUE] IN {50})

VAR __MEASURE_VALUE = SUM('H_CASC'[VALUE])

RETURN

    IF(

        NOT ISBLANK(__MEASURE_VALUE);

        DIVIDE(__MEASURE_VALUE - __BASELINE_VALUE; __BASELINE_VALUE) + 1

    )

 

Measure 2 =

MIN(H_W[VALUE])

 

 

 

I tried to do it in the Measure 3 but it does not work and I am not sure how to do it.

Thanks for any help on that matter.

 

Measure 3 (not working)=

VAR __BASELINE_VALUE = CALCULATE(SUM('H_CASC'[VALUE]); MIN(H_W[VALUE]))

VAR __MEASURE_VALUE = SUM('H_CASC'[VALUE])

RETURN

    IF(

        NOT ISBLANK(__MEASURE_VALUE);

        DIVIDE(__MEASURE_VALUE - __BASELINE_VALUE; __BASELINE_VALUE) + 1

    )

 

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @PatBen 

Try 

Measure 3 V2 =
VAR Min_ = MIN ( H_W[VALUE] )
VAR __BASELINE_VALUE = CALCULATE ( SUM ( 'H_CASC'[VALUE] ); H_W[VALUE] = Min_ ) VAR __MEASURE_VALUE = SUM ( 'H_CASC'[VALUE] ) RETURN IF ( NOT ISBLANK ( __MEASURE_VALUE ); DIVIDE ( __MEASURE_VALUE - __BASELINE_VALUE; __BASELINE_VALUE ) + 1 )

Please mark the question solved when done and consider giving kudos if posts are helpful.

 

Cheers  Datanaut

View solution in original post

2 REPLIES 2
PatBen
New Member

Hi @AlB 

 

Thank-you!

 

The measure works now and I understand the VAR logic.

 

Now I must solve a different issue (make my x-axis start value dynamic ...).

AlB
Community Champion
Community Champion

Hi @PatBen 

Try 

Measure 3 V2 =
VAR Min_ = MIN ( H_W[VALUE] )
VAR __BASELINE_VALUE = CALCULATE ( SUM ( 'H_CASC'[VALUE] ); H_W[VALUE] = Min_ ) VAR __MEASURE_VALUE = SUM ( 'H_CASC'[VALUE] ) RETURN IF ( NOT ISBLANK ( __MEASURE_VALUE ); DIVIDE ( __MEASURE_VALUE - __BASELINE_VALUE; __BASELINE_VALUE ) + 1 )

Please mark the question solved when done and consider giving kudos if posts are helpful.

 

Cheers  Datanaut

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.