Forum Discussion

nixonyx's avatar
nixonyx
Helper I
6 years ago
Solved

Dynamic calculation based on slicer value

I am trying to build a report that shows the impact of changing the start time of an event on the set up times and attendee arrival profile. This is then compared against other events occurring at th...
  • Icey's avatar
    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.