Forum Discussion

matrin's avatar
matrin
New Member
6 years ago
Solved

Last column value

Hi dear community,

 

I am new on Power BI Desktop and I need some help!

 

I've got a metric named "number of people" that can't be cumulated.

 

I want to return the last value of the column "number of people".

 

In fact, I import a database that provide the details of the number of people every day of the month. However, I don't have the number of the month provided, as the format of the date is "month - year" and can't be changed for some reasons.

To be clear, the file is presented like this:

february; 23

february; 29

february; 19

Thus, I want to return the last value of the column (19) which is in fact the last value of the month.

 

Can you please help me with this?

 

Thanks a lot in advance!!!

 

  • Hi matrin ,

     

    If you want to get the last value of a column, you can try the following DAX.

    Measure = CALCULATE(LASTNONBLANK('Table'[Column2],1),ALL('Table'))

    If the problem persists,could you please share sample data or sample .pbix?

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

    • matrin's avatar
      matrin
      New Member

      Thanks for your help.

       

      In fact, I don't want the maximum value but the very last one of the column.

       

      You're probably right, it won't work without days...

       

      • V-lianl-msft's avatar
        V-lianl-msft
        Community Support

        Hi matrin ,

         

        With the formula I created, I can get the desired results in my test data.

        If the problem persists,could you please share sample data or sample .pbix?

         

        Best Regards,
        Liang
        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • V-lianl-msft's avatar
    V-lianl-msft
    Community Support

    Hi matrin ,

     

    If you want to get the last value of a column, you can try the following DAX.

    Measure = CALCULATE(LASTNONBLANK('Table'[Column2],1),ALL('Table'))

    If the problem persists,could you please share sample data or sample .pbix?

     

    Best Regards,
    Liang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Hi,

    1. Do you have data for multiple months?
    2. Is there no year column?
    3. Is there an index column to let the user know the order in which the same months should appear?

    Share data for more months/year column/index column and shoe the expected result clearly.