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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
BiBra
Helper III
Helper III

latest Values

Hello, I am trying to find out how to get the latest values. Dummy data:

 

Name                Date                  Value 1            value2       value 3

sd                    12/10-2017               1                     0               1

tx                     12/10-2017               0                     1               0

sd                     13/12-2017               1                    1               0

 

I would like to be able to diplay the latest data for each "name", how to do this? I need a simple way to this,  because I have 53 "values". The ideal solution for me, would be to generate a table with only the latest values. So it automatically updates, and I am able to use the information as fit.

1 ACCEPTED SOLUTION

@BiBra

 

NOw you can use this MEASURE

 

Value at Recent Date =
CALCULATE (
    SUM ( TableName[Value] ),
    FILTER ( TableName, TableName[Date] = MAX ( TableName[Date] ) )
)

Regards
Zubair

Please try my custom visuals

View solution in original post

13 REPLIES 13
Zubair_Muhammad
Community Champion
Community Champion

@BiBra

 

One of the ways of doing it is to create a Calculated Table

 

Go to Modelling Tab >>> NEW TABLE

 

New Table =
SUMMARIZE (
    TableName,
    TableName[Name],
    "Date", MAX ( TableName[Date] ),
    "Value 1", CALCULATE (
        SUM ( TableName[Value 1] ),
        FILTER ( TableName, TableName[Date] = MAX ( TableName[Date] ) )
    ),
    "Value 2", CALCULATE (
        SUM ( TableName[Value 2] ),
        FILTER ( TableName, TableName[Date] = MAX ( TableName[Date] ) )
    ),
    "Value 3", CALCULATE (
        SUM ( TableName[Value 3] ),
        FILTER ( TableName, TableName[Date] = MAX ( TableName[Date] ) )
    )
)

Regards
Zubair

Please try my custom visuals

Any easier way? I have 53 "values"

@BiBra

 

In that case, unpivot the 53 columns using QUERY EDITOR

 

3500.png

 

 

You will get

 

3501.png

 

 


Regards
Zubair

Please try my custom visuals

@BiBra

 

NOw you can use this MEASURE

 

Value at Recent Date =
CALCULATE (
    SUM ( TableName[Value] ),
    FILTER ( TableName, TableName[Date] = MAX ( TableName[Date] ) )
)

Regards
Zubair

Please try my custom visuals

This works on one of my unpivoted columns thank you! 
It works on the column containing only 1 and 0 data. However I have another column,

where I want to do the same, however this column contains data that exceeds 1 and 0. 
How can I make that work?

PaulDBrown
Community Champion
Community Champion

@BiBraSorry, I'm not sure if you are referring to my suggestion. If so, can you explain further what the problem is? the function CLOSINGBALANCEMONTH or YEAR returns the last (date) value in a column. In other words, the field "value" must be in the same column in a table.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@PaulDBrown I am not referring to your solution. I am referring to @Zubair_Muhammad. When using his method. it works when the unpivoted column only contains 1 and 0, not when values higher. 

PaulDBrown
Community Champion
Community Champion

@BiBraOK, sorry...





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Is this only for one value?

@BiBra

 

No you will get all 53 values in one shot

 

Try it


Regards
Zubair

Please try my custom visuals

I have now tried it, however I trying to find out if I am able to use this measurein charts?

PaulDBrown
Community Champion
Community Champion

Not sure if this will work, but it might be worth a try:

 

last value = CLOSINGBALANCEMONTH([value], date[date])

 

EDIT: If the preriod you are looking at is a whole year, use CLOSINGBALANCEYEAR instead.





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






@BiBra

 

Use can then use a MATRIX VISUAL

 

Put

1) Name is Rows

2)Attribute in Columns

3) Value at Recent Date in Values

 

 

 

 

 

 


Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.