Forum Discussion

Jyo27's avatar
Jyo27
Helper II
3 years ago
Solved

current week ,Previous week

Hi everyone,

 

when user selects week slicer, table should display current week and previuos week data. 

Category week
A12
B12
C12
D12
E11
F11

For example if 12 th week is selected it should display both 12th and 11 th week category like A,B,C,DE,F. Can anyone please guide me with this issue . TIA.

  • Please create a New Table not related to the original table  and also a  Measure New Week in the original table,  as depicted in the screenshot below: Hope this helps

     

3 Replies

  • Make sure you have a slicer visual in your report that allows users to select a week.

    Then create the following :

     

    ShowRow = 
    VAR SelectedWeek = MAX('YourTableName'[week])
    RETURN 
    IF(
        'YourTableName'[week] = SelectedWeek || 'YourTableName'[week] = SelectedWeek - 1,
        1,
        0
    )
    

    Drag and drop the  created measure (ShowRow) into the visual level filters pane of your table visual.

    Set the filter to show values where ShowRow is 1.

    Now when you select a week from the slicer, the table should display rows corresponding to the selected week and the previous week.

  • AmiraBedh I see 2 issues with your solution (I could be wrong):

     

    1st you are using a column in the measure (in IF condition) which will not work because you need some sort of aggregation.

     

    2nd, if you are using the Week column from the same table on the slicer, it will filter the table on the selected week and other weeks will not be visible. To use the week in a slicer, a seperate table for the slicer will be required without any relations, and then use that in the measure. 

     

    Just my 2 cents.

  • Please create a New Table not related to the original table  and also a  Measure New Week in the original table,  as depicted in the screenshot below: Hope this helps