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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

query on power bi

Hello

I'm creating a column in my table in power bi, one I know how to get the data I want.

I have one customer column, another with the date and another with a specific value. the client repeats itself several times then there are different dates and values.

I'd like to know for each customer on their last date what value it has.

I just have this:

last - CALCULATE(MAX(table1[date]),FILTER(table1,table1[client]-EARLIER([client])))

the last date of each client but I don't know how to place in this new column the value you got on your last date.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @stephaniefalvay ,

You can try to create a measure as below screenshot shown to get the value on the most recent date:

Value for latest date per client = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table 1'[date] ),
        FILTER (
            ALLSELECTED ( 'Table 1' ),
            'Table 1'[client] = MAX ( 'Table 1'[client] )
        )
    )
RETURN
 CALCULATE (
        MAX ( 'Table 1'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table 1' ),
            'Table 1'[client] = MAX ( 'Table 1'[client] )
                && 'Table 1'[date] = _maxdate
        )
    )

the value on the latest date.JPG

Best regards

Rena

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

hola,

 

como seria si quiero crear la columna? con la medida me va bien, pero no puedo hacer una grafica no me deja usar esta medida en Axis

 

gracias 

Anonymous
Not applicable

Hello @stephaniefalvay ,

You can try to create a measure as below screenshot shown to get the value on the most recent date:

Value for latest date per client = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table 1'[date] ),
        FILTER (
            ALLSELECTED ( 'Table 1' ),
            'Table 1'[client] = MAX ( 'Table 1'[client] )
        )
    )
RETURN
 CALCULATE (
        MAX ( 'Table 1'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table 1' ),
            'Table 1'[client] = MAX ( 'Table 1'[client] )
                && 'Table 1'[date] = _maxdate
        )
    )

the value on the latest date.JPG

Best regards

Rena

Anonymous
Not applicable

thank you Rena.

but I made a change if I left it so I only had one value in all the customers.

instead of the MAX placeeARLIER (table1[client])

thanks again

Best regards

Anonymous
Not applicable

Hi @Anonymous ,

You are trying to create calculated column or measure? The formula which I provided in my previous post is for measure not calculated column...

Best Regards

Rena

Greg_Deckler
Community Champion
Community Champion

@Anonymous - Seems like you want Lookup Min/Max - https://community.powerbi.com/t5/Quick-Measures-Gallery/Lookup-Min-Max/m-p/985814#M434

 

If not, Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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