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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MA_guy_VER
Advocate I
Advocate I

Return a value associated to a date with criteria

Hi - It's the new guy again... 

 

I am looking to return the value associated with a date. 

 

In this example, you can see in yellow the areas I am in need of using:  If 6 Weeks = 1, Find the MAX date (August 21) from that grouping and then return the PROJ BAL (84) associated with that date.

 

MA_guy_VER_0-1658176868644.png

 

Thank you in advance once again.  This community is so helpful!

1 ACCEPTED SOLUTION

Hi @MA_guy_VER 

 

You can create a measure with below code. I assume that you want to get the [PROJ BAL] value of every item on their associated maximum date. To display the result, you can put the measure into a table along with the [Item #] column. 

Result =
VAR _maxDate =
    CALCULATE (
        MAX ( 'Table'[Curr Cust Ship] ),
        ALLEXCEPT ( 'Table', 'Table'[Item #] ),
        'Table'[6 Weeks] = 1
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[PROJ BAL] ),
        ALLEXCEPT ( 'Table', 'Table'[Item #] ),
        'Table'[Curr Cust Ship] = _maxDate
    )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

4 REPLIES 4
MA_guy_VER
Advocate I
Advocate I

@amitchandak My apologies if it is not clear.

 

With the above example, I want to filter the data on 6 Week and only take the "1"s.  Then from the grouping of the "1" I want to get the MAX Date from that group (Curr Cust Ship).  Once the MAX date is determined, I want to return the value in the PROJ BAL column associated with the MAX Date.  Based on the above, the MAX date is August 21, 2022 and the value that should return is 84.  The end result should be returning the number 84 in this example.  Thank you and I hope this makes the ask more clear.

Hi @MA_guy_VER 

 

You can create a measure with below code. I assume that you want to get the [PROJ BAL] value of every item on their associated maximum date. To display the result, you can put the measure into a table along with the [Item #] column. 

Result =
VAR _maxDate =
    CALCULATE (
        MAX ( 'Table'[Curr Cust Ship] ),
        ALLEXCEPT ( 'Table', 'Table'[Item #] ),
        'Table'[6 Weeks] = 1
    )
RETURN
    CALCULATE (
        MAX ( 'Table'[PROJ BAL] ),
        ALLEXCEPT ( 'Table', 'Table'[Item #] ),
        'Table'[Curr Cust Ship] = _maxDate
    )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

@v-jingzhang Nailed it!  Thank you very much for the assistance.  Much appreciated!

amitchandak
Super User
Super User

@MA_guy_VER , The information you have provided is not making the problem clear to me. Can you please explain with an example.

 

You can try a measure like

 

calculate(Sum(Table[PROJ BAL]), filter(Table, [6 Weeks] = 1 )) 

 

Plot with dates and other column


Appreciate your Kudos.


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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