Forum Discussion
Dynamic calculation based on slicer value
- 6 years ago
Hi nixonyx ,
I have adjusted your PBIX. See the attached file.
For your WISH LIST,
1. only show events on the 'Expected' chart starting within 30 mins of selected event;
- Create a EventID Table without any relationship among other tables.
EventID Table = VALUES('sample'[EventID])- Create a measure.
Adjust ExpAttendees = IF ( ( MAX ( 'sample'[EventStart] ) >= ( [CurrentEventStart+AjustTime] - 30 / ( 24 * 60 ) ) ) && ( MAX ( 'sample'[EventStart] ) <= ( [CurrentEventStart+AjustTime] + 30 / ( 24 * 60 ) ) ), MAX ( 'sample'[ExpAttendees] ) )2. change the ExpSetUpTime, ExpReadyTime, EventStart by 'Adjust event start time' selected value and display the new values (e.g. in a card);
- Create Measures.
Selected EventID = SELECTEDVALUE('EventID Table'[EventID])Selected EventDate = CALCULATE ( MAX ( 'sample'[EventDate] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )SelectedThemeID = CALCULATE ( MAX ( 'sample'[EventThemeID] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )Selected EventSubThemeID = CALCULATE ( MAX ( 'sample'[EventSubThemeID] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )SelectedLocalID = CALCULATE ( MAX ( 'sample'[LocationID] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )Selected ExpSetUpTime = CALCULATE ( MAX ( 'sample'[ExpSetUpTime] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )Selected ExpReadyTime = CALCULATE ( MAX ( 'sample'[ExpReadyTime] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )Selected EventStart = CALCULATE ( MAX ( 'sample'[EventStart] ), FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] ) )3. only show events on the 'Adjusted' chart starting within 30 mins of adjusted event start time for the selected event.
What's the difference between 1 and 3? Sorry, I can't understand it well.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi nixonyx ,
I have adjusted your PBIX. See the attached file.
For your WISH LIST,
1. only show events on the 'Expected' chart starting within 30 mins of selected event;
- Create a EventID Table without any relationship among other tables.
EventID Table = VALUES('sample'[EventID])
- Create a measure.
Adjust ExpAttendees =
IF (
(
MAX ( 'sample'[EventStart] ) >= ( [CurrentEventStart+AjustTime] - 30 / ( 24 * 60 ) )
)
&& (
MAX ( 'sample'[EventStart] ) <= ( [CurrentEventStart+AjustTime] + 30 / ( 24 * 60 ) )
),
MAX ( 'sample'[ExpAttendees] )
)
2. change the ExpSetUpTime, ExpReadyTime, EventStart by 'Adjust event start time' selected value and display the new values (e.g. in a card);
- Create Measures.
Selected EventID = SELECTEDVALUE('EventID Table'[EventID])Selected EventDate =
CALCULATE (
MAX ( 'sample'[EventDate] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
SelectedThemeID =
CALCULATE (
MAX ( 'sample'[EventThemeID] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
Selected EventSubThemeID =
CALCULATE (
MAX ( 'sample'[EventSubThemeID] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
SelectedLocalID =
CALCULATE (
MAX ( 'sample'[LocationID] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
Selected ExpSetUpTime =
CALCULATE (
MAX ( 'sample'[ExpSetUpTime] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
Selected ExpReadyTime =
CALCULATE (
MAX ( 'sample'[ExpReadyTime] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
Selected EventStart =
CALCULATE (
MAX ( 'sample'[EventStart] ),
FILTER ( ALL ( 'sample' ), 'sample'[EventID] = [Selected EventID] )
)
3. only show events on the 'Adjusted' chart starting within 30 mins of adjusted event start time for the selected event.
What's the difference between 1 and 3? Sorry, I can't understand it well.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Icey
Thank you so much! I will take a closer look today.
The difference between 1 and 3 is the time stamp used. 1 uses the original event start and 3 uses the adjusted event start.
For example, if an event was due to start at 10:00, the Expected chart would show the attendee presentation profiles for all events starting between 09:30 and 10:30.
If the event start was then adjusted to 10:15, the Predicted chart would show the attendee presentation profiles for all events (including an adjusted presentation profile for the one updated) starting between 09:45 and 10:45.
The two charts would then be compared to see if a peak in arrival was evened out or made worse.
Hope that makes sense!