Forum Discussion

Sammy22's avatar
Sammy22
Helper I
1 year ago
Solved

Periods parameter for user flexibility

Hello,

 

I have a report which currently has set periods, P1 is 2023 and P2 is 2024. Users want to be able to change the date ranges of these periods, for example, they may want to look at the first half of 2022 vs 2023. Below is an example of how i would want this to work.

 

I have tried to follow the below process. I can create 2 calendar tables, 2 date paramters however, i cannot 'bind to parameter'. This isn't visible. Appreciate the help.

 

Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

  • hello Sammy22 

     

    the best way is using filter pane as mentioned by lbendlin .

     

    if you want tricky way, here is an example of what i did for my project.

    1. create a duplicate table of your original table, something like this.

    Table 2 = 'Table'
    2. create P1 and P2 measure which P1 takes value from original table and P2 takes value from duplicated table.
    P1 = 
    IF(
        ISFILTERED('Table'),
        SUM('Table'[Orders])
    )
    P2 = 
    IF(
        ISFILTERED('Table 2'),
        SUM('Table 2'[Orders])
    )
    3. plot your slicer and measure. similarly as above, slicer 1 from original table and slicer 2 from duplicated table.

     

    Hope this will help.

    Thank you.

8 Replies

  • For maximum flexibility use the Filter Pane and teach your users how to operate it.

    • Sammy22's avatar
      Sammy22
      Helper I

      Are you able to share more details? What do you mean by the filter pane?

  • Irwan's avatar
    Irwan
    Super User

    hello Sammy22 

     

    the best way is using filter pane as mentioned by lbendlin .

     

    if you want tricky way, here is an example of what i did for my project.

    1. create a duplicate table of your original table, something like this.

    Table 2 = 'Table'
    2. create P1 and P2 measure which P1 takes value from original table and P2 takes value from duplicated table.
    P1 = 
    IF(
        ISFILTERED('Table'),
        SUM('Table'[Orders])
    )
    P2 = 
    IF(
        ISFILTERED('Table 2'),
        SUM('Table 2'[Orders])
    )
    3. plot your slicer and measure. similarly as above, slicer 1 from original table and slicer 2 from duplicated table.

     

    Hope this will help.

    Thank you.

    • Sammy22's avatar
      Sammy22
      Helper I

      thanks for your help! What if i also want to group by a field that exists in both tables. If i select a field from Table 1 then the orders will be broken down for Table 1 (P1) only and Table 2 (p2) Orders will just show a total.

      • Irwan's avatar
        Irwan
        Super User

        hello Sammy22 

         

        i might be misunderstood but if you mean by "group by a field" is calculation result from selecting field, then you can add your field as filter so it will calculate each of those fields.

         

        something like this, calculate(sum('Table'[Orders]),filter(allselected('Table'),'Table[Field]=.....))

         

        otherwise, please share your sample data and your desired outcome.

         

        Thank you.