Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Get values from last month

I have a excel document which contains the following data:

 

 

Is it possible to create a DAX query that will show me the data from last month e.g:

Dummy4, Dummy5? 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous,

    In fact, measure expressions are calculated based on filter and row contexts.

    Row Context and Filter Context in DAX - SQLBI
    If you do not want to apply any filter to your visual, it means you need to manually add particular filter expressions to all of the formulas which need to achieve this effect.
    Regards,

    Xiaoxin Sheng

3 Replies

  • Anonymous , Assume you have date, Create a measure and use that in visual or visual level filter

     

    measure =

    var _max=  maxx(allselected(Table), Table[date])

    return

    calculate(countrows(Table), filter(Table, eomonth(Table[Date],0) = eomonth(_max,0) ) )

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi amitchandak Thank you for your response. I was hoping to wrap it into one instead of using it as a filter. Is there a way to get the measure to return all the results required without the need of using it as filter?

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Anonymous,

        In fact, measure expressions are calculated based on filter and row contexts.

        Row Context and Filter Context in DAX - SQLBI
        If you do not want to apply any filter to your visual, it means you need to manually add particular filter expressions to all of the formulas which need to achieve this effect.
        Regards,

        Xiaoxin Sheng