Forum Discussion

syaifulefendi's avatar
syaifulefendi
Frequent Visitor
3 years ago
Solved

Getting filter result from selected period

Hi Guys  I need your magic help here . actually im having a data ( attached below ) region_nm branch provinsi kabkota item_nm brand_nm month metric val val_target REGION 3 MAKASS...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi syaifulefendi 

    You can create a date table first

    e.g 

    Table 2 = CALENDAR(DATE(YEAR(MIN('Table'[month])),1,1),DATE(YEAR(MAX('Table'[month])),12,31))

    The relationship between two table

     

    Then create a measure

    Measure = var a=MIN('Table 2'[Date])
    var b= EOMONTH(a,-13)+1
    return CALCULATE(SUM('Table'[val]),CROSSFILTER('Table'[month],'Table 2'[Date],None),'Table'[month]<=EOMONTH(a,0)&&'Table'[month]>b)

    Then put the measure to the table visual and put the column of date table to slicer.

    Output

     

    Best Regards!

    Yolo Zhu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.