Forum Discussion
Conditional Measure using slicer selection
- Anonymous2 years ago
Hi Rob92 ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a sperated date dimension table(DO NOT create any relationship with your fact table) just as suggested by Ibendlin
2. Create two measures as below
Old clients count = VAR _mindate = MIN ( 'Date'[Date] ) RETURN CALCULATE ( SUM ( 'Table'[Transactions] ), FILTER ( 'Table', 'Table'[Client_joined] <= _mindate ) )New clients count = VAR _mindate = MIN ( 'Date'[Date] ) RETURN CALCULATE ( SUM ( 'Table'[Transactions] ), FILTER ( 'Table', 'Table'[Client_joined] > _mindate ) )3. Create a table visual as shown in the below screenshot
Best Regards
- 2 years ago
Awesome, thanks guys! I have implemented the solution on my real data and it works a treat. The only issue was that as well as the slicer controlling which users are new or old, I also need it to filter the visual. In order to do this I have joined the date dimension table to the fact table. This causes the date hierachy to break but that's not a problem - to resolve that, I added separate month and year columns in power query, and used those on the X axis instead. Problem solved!
Hi Rob92 ,
I created a sample pbix file(see the attachment), please check if that is what you want.
1. Create a sperated date dimension table(DO NOT create any relationship with your fact table) just as suggested by Ibendlin
2. Create two measures as below
Old clients count =
VAR _mindate =
MIN ( 'Date'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Transactions] ),
FILTER ( 'Table', 'Table'[Client_joined] <= _mindate )
)New clients count =
VAR _mindate =
MIN ( 'Date'[Date] )
RETURN
CALCULATE (
SUM ( 'Table'[Transactions] ),
FILTER ( 'Table', 'Table'[Client_joined] > _mindate )
)
3. Create a table visual as shown in the below screenshot
Best Regards