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 ...
  • speedramps's avatar
    1 year ago

    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

     

  • maruthisp's avatar
    1 year ago

    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.