Forum Discussion

DanSanDST's avatar
DanSanDST
Helper I
1 year ago
Solved

Filtering data on graph to current and previous year, according to date slicer.

Greetings, im trying to do something i already figured out a year ago, but reproducing it and using the same DAX formula now gives a different result.   First i limit the max date to read data with...
  • DanSanDST's avatar
    1 year ago

    Welp i though i solved it, since my previous reasoning, i figured i needed to calculate the max date and year every time while using all the data and not just current row:

    sum curr/prev saidi emp = 
    var _fech = CALCULATE(max(Table1[fh_inicio_interrupcion]),ALL(Table1[Year]))
    return
    calculate(SUM(Table1[SAIDI empresa]), FILTER(table1, Table1[Year]>=YEAR(_fech)))

    this returns:

    wich seems odd that it takes the values from previous year up until the selected month?? At first i had "ALL(Table1)" inside the calculate in "var _fech", wich would give me always the max date on the data, so if i slice my dates UNTIL 2023, it wouldnt show any data since it will always calculate the max year in all current data.