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
mariajuliao
Frequent Visitor

Latest Value

Hello,

 

I want to create a measure or table that shows the latest value. I have a table that looks like this:

 

Device_SerialNumberDateSoftware_Version
123451/1/20222.3
123451/2/20222.3
123451/3/20222.3.1
123451/4/20222.3.1
123451/5/20222.3.1
123451/6/20222.2

 

I wanted to use Latest Software Version = MAX(Software_Version) , but that would result in the greatest value, rather than the last according to the date column. What can I use?

1 ACCEPTED SOLUTION

@mariajuliao try this:

 

 

Measure = 
VAR _max_date = CALCULATE(MAX('Table'[Date]), REMOVEFILTERS('Table'[Date]))
VAR _result = 
    CALCULATE(
        CONCATENATEX('Table','Table'[Software_Version], ", "),
        'Table'[Date] = _max_date
    )
RETURN
    _result

 

 


In case you have a date table then it will be like this:

 

Measure = 
VAR _max_date = CALCULATE(MAX('Table'[Date]), REMOVEFILTERS('Date')
VAR _result = 
    CALCULATE(
        CONCATENATEX('Table','Table'[Software_Version], ", "),
        'Table'[Date] = _max_date
    )
RETURN
    _result

 


Let me know if that was it or we need to go deeper 🙂



2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

View solution in original post

4 REPLIES 4
SpartaBI
Community Champion
Community Champion

@mariajuliao 
Write this:

Measure = 
VAR _max_date = CALCULATE(MAX('Table'[Date]), REMOVEFILTERS())
VAR _result = 
    CALCULATE(
        CONCATENATEX('Table','Table'[Software_Version], ", "),
        'Table'[Date] = _max_date
    )
RETURN
    _result


Here is a link to download the file with the solution:

Latest Value 2022-07-28.pbix



2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

I believe this formula would work if I was only looking for the latest software version of all. I want to be able to see it per device serial number, device type, and other columns in the table. 

 

The output should be something like this:

 

Device_SerialNumberLatest_Software_Version
12345  2.2
12346  2.3.1
12347  2.3

 

And also be able to do a count like this:

 

Latest_Software_VersionCount_of_Device_Serial_Number_Distinct
2.210
2.311
3.03
3.17
3.1.125

 

@mariajuliao try this:

 

 

Measure = 
VAR _max_date = CALCULATE(MAX('Table'[Date]), REMOVEFILTERS('Table'[Date]))
VAR _result = 
    CALCULATE(
        CONCATENATEX('Table','Table'[Software_Version], ", "),
        'Table'[Date] = _max_date
    )
RETURN
    _result

 

 


In case you have a date table then it will be like this:

 

Measure = 
VAR _max_date = CALCULATE(MAX('Table'[Date]), REMOVEFILTERS('Date')
VAR _result = 
    CALCULATE(
        CONCATENATEX('Table','Table'[Software_Version], ", "),
        'Table'[Date] = _max_date
    )
RETURN
    _result

 


Let me know if that was it or we need to go deeper 🙂



2022-05-19 17_30_22-Re_ Need help on DAX function with measure vs colu... - Microsoft Power BI Commu.png


Full-Logo11.png

SpartaBI_3-1652115470761.png   SpartaBI_1-1652115142093.png   SpartaBI_2-1652115154505.png

Showcase Report – Contoso By SpartaBI

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.