Forum Discussion
Sync slicers created by field parameters
- 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
- 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.
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.