Forum Discussion

Mype_powerbi's avatar
Mype_powerbi
Frequent Visitor
7 years ago
Solved

Get last value in date selection for a string

Hello,

 

I'm spending much time on doing something I've already done with numbers and now I 'm struggling to do it with text values. 

 

I have a table (Records_Africa) with two columns, [AGILITY SCORE] and [Month]. 

Agility score visual should display [AGILITY SCORE] value from July 2016 because user sliced it.

[AGILITY SCORE] contains text values such as "WARNING", "EXCELLENT", "ALERT".

 

In my report, a date slicer uses [Month] column and this slicer is filtered by the user. 

There is also a Card visual that displays Agility Score.

I want this card visual to display only LATEST value of AGILITY SCORE, within the Month slicer selection made by the user.

How can I do that please ?

PS : With numbers, formula works, it is :

CALCULATE(SUM('Records_Africa'[Monthly Downloads]);LASTDATE('Records_Africa'[Month]))
 
Please just teach me how to do it with a field that is not numbers !

 

  • tex628's avatar
    tex628
    7 years ago

    Replace the AVERAGE() with a SELECTEDVALUE()?

    Measure = 
    VAR maxDate = MAX('Records_Africa'[Month])
    Return
    CALCULATE(SELECTEDVALUE('Records_Africa'[Agility Score]);
    'Records_Africa'[Month] = maxDate
    )

    But you will have an issue if there are more than 1 agility score on the same date. 

16 Replies

    • Mype_powerbi's avatar
      Mype_powerbi
      Frequent Visitor

      Greg_Deckler ,

      False.

       

      The field is not numbers but text. 

      I think we should replace CALCULATE AVERAGE by smth else but I don't know how.

       

      • v-lili6-msft's avatar
        v-lili6-msft
        Community Support

        hi, Mype_powerbi 

        You need to add a map calculated column for [Month] for calculation or add a dim date table then create the relationship with basic data by month, and then use it for calculation.

         

        Best Regards,

        Lin