Forum Discussion

ph's avatar
ph
Helper I
7 years ago
Solved

DAX - get value from measure

Hi all,

I am beginner and I was wondering if somebody can help me with following problem

 

I have measure (Amount) that is for each date different, and I want get actual value for today..

logically I thought that FILTER should solve my problem, but it does not works for measures (any idea why?) Which function/code can be accurate?

 

current status is that measure returns only SUM of all values, instead of last single value 

I haven t knowledge/skill to rewrite measure

  • Sure. Since you already have a measure for [Amount], you can just calculate it with a new context. 

    AmountToday = CALCULATE( [Amount], Table[Date] = TODAY())

     

    If this doesn't work, can you share your current code for [Amount]?

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Without knowing your model no answer is possible.

     

    Best

    Darek

    • ph's avatar
      ph
      Helper I

      Hi Darek,

      what exactly should I fill in?

      I need to get one value from one table based on the filter from another table, and I did not found any function for it (or take last value in the column (sorted by date))

      • Anonymous's avatar
        Anonymous
        Not applicable

        You say "I want to get one value from one table based on a filter from another table (or take last value in the column (sorted by date))." Your statement is about as clear as mud.

         

        Sorry. With this level of detail, I can't do much even if I wanted :(

         

        For instance, do you really want to get one value from some column when there is a filter on a different table? What if there are many values that the filter makes visible? Do you then want the MAX, the MIN of the values? You also say "take last value in the column." That would point to some kind of MAX or MIN... but then sorted by date - descending? Ascending? There are many more questions... but let's stop here.

         

        When you ask questions, it would really be good---and you'll do yourself a big favor---if you could be precise. Otherwise, you risk not getting any answers because people should not have to decipher and make guesses about what it is you wanted to do... They should know exactly what you want(ed) to do.

         

        Best

        Darek

  • Cmcmahan's avatar
    Cmcmahan
    Resident Rockstar

    Sure. Since you already have a measure for [Amount], you can just calculate it with a new context. 

    AmountToday = CALCULATE( [Amount], Table[Date] = TODAY())

     

    If this doesn't work, can you share your current code for [Amount]?