Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Need values within two selected slicers

I have a fact table containing week_id. Now I need two slicers which will contain week from and week to. Both slicer will come from that fact table or week dimention table. Now I need to show week by week sales between two weeks selected from those slicers. I dont know how to do this. I tried to make a table containing the weeks between those selected weeks but its not showing any data.

  • Hi Anonymous 

    please try this,

    >> to show week by week sales between two weeks selected from those slicers

    Fact table

    week dimention table

    there is no need to create 2 slicers, use between type slicer instead,

    then create the measure below, put it into visual level filter and set it to 1

    filtermeasure = 
    var _weekfrom=MINX(ALLSELECTED('Date'),'Date'[Week])
    var _weekto= MAXX(ALLSELECTED('Date'),[Week])
    return IF(MAX('Table'[week_id]) <=_weekto && MAX('Table'[week_id])>= _weekfrom,1,0)
    

    result

     

    Best Regards,

    Community Support Team _Tang

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

2 Replies

  • PaulDBrown's avatar
    PaulDBrown
    Icon for Community Champion rankCommunity Champion

    Does your data cover many years? Also, what do the values of week id look like? Do you have any other date-related fields? Can you post some sample data?

  • v-xiaotang's avatar
    v-xiaotang
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    please try this,

    >> to show week by week sales between two weeks selected from those slicers

    Fact table

    week dimention table

    there is no need to create 2 slicers, use between type slicer instead,

    then create the measure below, put it into visual level filter and set it to 1

    filtermeasure = 
    var _weekfrom=MINX(ALLSELECTED('Date'),'Date'[Week])
    var _weekto= MAXX(ALLSELECTED('Date'),[Week])
    return IF(MAX('Table'[week_id]) <=_weekto && MAX('Table'[week_id])>= _weekfrom,1,0)
    

    result

     

    Best Regards,

    Community Support Team _Tang

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