Forum Discussion

DanCasSan's avatar
DanCasSan
Icon for Helper V rankHelper V
5 years ago
Solved

Filter that does not affect calculated measure

Hello community.

 

I have a formula that calculates the purchase value; however, within that calculation I am telling you to only consider the month of December. I also have several segmenters that I use as a filter such as year and month, and when I select a month other than December, I get 0 in my formula.

 

DAX formula:

Purchase value LP = CALCULATE ([Purchase value], DATEADD (Calendar [Date], - 1, YEAR), Calendar [Month No.] = 12)

 

I need to do the following:

1. If a closed or finished year is selected, you should always take the data for the month of December of the previous year.
2. When filtering any month from the segmenter, the measure must not change, it must remain fixed with the month of December of the previous year.

 

I thank you in advance for your support.

 

Reggards,

DC

  • @DanCasSan, if there are any other filter that can delete month, then you may not get data for dec ,

    You can get the last month of last year as

    example: date is my calendar table

    el año pasado el pasado MTD Ventas ?
    var _max á datediff(startofyear('Date'[Date],"12/31"), maxx(allselected('Date'), 'Date'[Date]),month)
    devolución
    CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1*_max,MONTH)))

1 Reply

  • @DanCasSan, if there are any other filter that can delete month, then you may not get data for dec ,

    You can get the last month of last year as

    example: date is my calendar table

    el año pasado el pasado MTD Ventas ?
    var _max á datediff(startofyear('Date'[Date],"12/31"), maxx(allselected('Date'), 'Date'[Date]),month)
    devolución
    CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1*_max,MONTH)))