Forum Discussion

LuukP's avatar
LuukP
Icon for Helper I rankHelper I
3 years ago
Solved

One date slicer, two table visuals showing different years

Hello everyone,   Here is a (hopefully) simple problem that I've been struggling with on various occasions. I'll use a simple example to illustrate what I mean:   Suppose I have a table with the ...
  • MFelix's avatar
    MFelix
    3 years ago

    Hi LuukP ,

     

    In this case you need to do for example a count rows and this depending on the columns you use will return for example 1 (if you selected a specific book), or 10 (if you aggregate by author or date) then you can use that value to filter your list.

     

    I created the following measure:

    Books previou year = 
    
    CALCULATE (
       COUNTROWS(Books),
        SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
    )

     

    See result below:

    Has you can see I'm getting the books for current year and previous year.

     

    If you need you can change the metric to give you a list of books or dates depending on the aggregation.

     

    Making a small change I have  created one for the books and use it in a list:

    Books previou year = 
    
    CALCULATE (
       CONCATENATEX(Books,Books[Book Title], ","),
        SAMEPERIODLASTYEAR ( 'Calendar'[Date] )
    )

    You just need to pick up one value to get the filter made for you data.