Forum Discussion

Clikojo's avatar
Clikojo
Frequent Visitor
1 year ago
Solved

Sync slicers created by field parameters

Hi all,

I used this video to create some KPI visuals to demonstrate % change to previous month and previous quater. For example, on the card visual it will show total customers, % change compared to last month and % changed comapred to previous quater.

To filter on which comparison the values should show, I created a slicer by creating field parameters based on the previous month and previous quater meausres. Now my issue is if i want to create more card visuals I have to create more slicers in the same method. Can I sync these slicers somehow? Here is an exaple of the DAX that is an input to the meaure used in my field parameter

CW KPI new users vs prev month =
VAR _var = [CW_New] - [CW_PreviousMonth]
VAR _pct = DIVIDE([CW_New], [CW_PreviousMonth]) - 1
VAR _sign = IF(_var > 0, "+", "")
RETURN
_sign & FORMAT(_pct, "#0.0%") & " | " & _sign & FORMAT(_var, "#0,#")



Thanks in advance!

  • Please can you describe your problem more clearly with examples.

    Dont rush. You will get quicker and better answers if you put time and effort into the question.

     

    Have you consider using Field Parametrs and Calculation Groups?

     

    If you have a field paramater for total orders, sales $, cost of sales and proifit $.

     

    Then you create a calcuation group for This Month, Last Month or Difference and add the claulcation group to slicer then the calculatin group will apply to all the measures, just like magic !

     

    learn how here 

     

    https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups

     

    Please click the thumbs up and [accept solution] buttons, 

    Thank you

     

  • Hi Clikojo,
    As per your description, you have a Fact Table and Date Dimension table.

     Step 1: Create Base Measures

    Total Customers = SUM(CustomerMetrics[CustomerCount])
     

    Previous Month Customers =
    CALCULATE(
        [Total Customers],
        DATEADD(DateTable[Date], -1, MONTH)
    )
     

    Previous Quarter Customers =
    CALCULATE(
        [Total Customers],
        DATEADD(DateTable[Date], -1, QUARTER)
    )

    Step 2: Create Comparison Measures

    Change vs Previous Month =
    VAR Diff = [Total Customers] - [Previous Month Customers]
    VAR Pct = DIVIDE(Diff, [Previous Month Customers])
    RETURN FORMAT(Pct, "0.0%") & " | " & FORMAT(Diff, "#,0")
     

    Change vs Previous Quarter =
    VAR Diff = [Total Customers] - [Previous Quarter Customers]
    VAR Pct = DIVIDE(Diff, [Previous Quarter Customers])
    RETURN FORMAT(Pct, "0.0%") & " | " & FORMAT(Diff, "#,0")


    Step 3: Create a Field Parameter


    ComparisonSelector = {
        ("Change vs Previous Month", [Change vs Previous Month], 0),
        ("Change vs Previous Quarter", [Change vs Previous Quarter], 1)
    }

    Step 4: Use the Parameter in Visuals
    Use the ComparisonSelector field in a slicer and use the Selected Measure in your card visuals.

     

5 Replies

  • Please can you describe your problem more clearly with examples.

    Dont rush. You will get quicker and better answers if you put time and effort into the question.

     

    Have you consider using Field Parametrs and Calculation Groups?

     

    If you have a field paramater for total orders, sales $, cost of sales and proifit $.

     

    Then you create a calcuation group for This Month, Last Month or Difference and add the claulcation group to slicer then the calculatin group will apply to all the measures, just like magic !

     

    learn how here 

     

    https://learn.microsoft.com/en-us/power-bi/transform-model/calculation-groups

     

    Please click the thumbs up and [accept solution] buttons, 

    Thank you

     

  • Hi Clikojo,
    As per your description, you have a Fact Table and Date Dimension table.

     Step 1: Create Base Measures

    Total Customers = SUM(CustomerMetrics[CustomerCount])
     

    Previous Month Customers =
    CALCULATE(
        [Total Customers],
        DATEADD(DateTable[Date], -1, MONTH)
    )
     

    Previous Quarter Customers =
    CALCULATE(
        [Total Customers],
        DATEADD(DateTable[Date], -1, QUARTER)
    )

    Step 2: Create Comparison Measures

    Change vs Previous Month =
    VAR Diff = [Total Customers] - [Previous Month Customers]
    VAR Pct = DIVIDE(Diff, [Previous Month Customers])
    RETURN FORMAT(Pct, "0.0%") & " | " & FORMAT(Diff, "#,0")
     

    Change vs Previous Quarter =
    VAR Diff = [Total Customers] - [Previous Quarter Customers]
    VAR Pct = DIVIDE(Diff, [Previous Quarter Customers])
    RETURN FORMAT(Pct, "0.0%") & " | " & FORMAT(Diff, "#,0")


    Step 3: Create a Field Parameter


    ComparisonSelector = {
        ("Change vs Previous Month", [Change vs Previous Month], 0),
        ("Change vs Previous Quarter", [Change vs Previous Quarter], 1)
    }

    Step 4: Use the Parameter in Visuals
    Use the ComparisonSelector field in a slicer and use the Selected Measure in your card visuals.

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Clikojo,

    Thank you  for reaching out to the Microsoft fabric community forum.

    I would also take a moment to thank maruthisp, and speedramps  for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
     

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If the response has addressed your query, please Accept it as a solution so that other community members can find it easily.

     

    Best Regards,

    Harshitha.

    Community Support Team.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Clikojo ,

      I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please Accept it as a solution so that other community members can find it easily.

      Best Regards,

      Harshitha.

      Community Support Team.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Clikojo,

        May I ask if you have resolved this issue? If so, please mark the helpful reply and Accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

        Best Regards,

        Harshitha.

        Community Support Team.