Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Matrix creating multiple period when new measure is inserted

Hi
I have below matrix, when I filter only for FY24: P01 I get all the years for that period. Look like doesn't apply the filter (slicer)

Diff_hours column measure below I appli :

DIFF_HOURS =
VAR Selection         = SELECTEDVALUE (RESOURCE_RPT_HEADER[LOCATION]) -- location = Canada / United States of America / India
VAR overallocatedflag = CALCULATE([OVER_ALLOCATED_HOURS_FLAG], all(RESOURCE_RPT_HEADER[LOCATION])) -- this flag is "Y" when forecast hours > BillsHours country Ex. 216 > 152
VAR SelectCanada      = SELECTEDVALUE (RESOURCE_RPT_LINE[CALENDAR.BillsHours_CA]) -- bills for canada Fy24:P01 = 152
VAR SelectUS          = SELECTEDVALUE (RESOURCE_RPT_LINE[CALENDAR.BillsHours_US])
VAR SelectIndia       = SELECTEDVALUE (RESOURCE_RPT_LINE[CALENDAR.BillsHours_IN])

RETURN
SWITCH (
    TRUE (),

    selection = "Canada"  && [OVER_ALLOCATED_HOURS_FLAG] = "Y",
                    IF(
                        -- If 216 > 152 then 216-152 = 64
                     SUM(RESOURCE_RPT_LINE[FORECAST_HOURS]) > SelectCanada,  (calculate(SUM(RESOURCE_RPT_LINE[FORECAST_HOURS])) -
                    (SelectCanada)), 0
                      ),
    selection = "United States of America"  && [OVER_ALLOCATED_HOURS_FLAG] = "Y",
                    IF(
                     SUM(RESOURCE_RPT_LINE[FORECAST_HOURS]) > SelectUS,  (calculate(SUM(RESOURCE_RPT_LINE[FORECAST_HOURS])) -
                    (SelectUS)) ,0
                      ),
    selection = "India"  && [OVER_ALLOCATED_HOURS_FLAG] = "Y",
                    IF(
                     SUM(RESOURCE_RPT_LINE[FORECAST_HOURS]) > SelectIndia,  (calculate(SUM(RESOURCE_RPT_LINE[FORECAST_HOURS])) -
                    (SelectUS)) , 0
                      ),
                      0
)
  • Anonymous's avatar
    Anonymous
    2 years ago

    Thanks Team_Binbin Yu I founded the issue was in switch condition last sentence equal to 0... 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Please try below steps:

    1. Review Slicer Configuration: Ensure that your slicer is correctly configured to filter by the period you're interested in (FY24: P01). It's important to verify that the slicer is connected to the correct field and that it's indeed filtering the data as expected.

     

    2. Check the Measure Logic: Review the logic within your DIFF_HOURS measure, especially how it interacts with the slicer's selection. Since your measure uses SELECTEDVALUE to determine the location and then applies logic based on that selection, ensure that the measure is correctly recalculating based on the slicer's filter. It might be helpful to test the measure's output by manually setting the location values to see if the expected results are returned.

     

    3. Examine Matrix Visual-Level Filters: If your matrix visual is showing all years despite the slicer filter, it's possible that there might be an issue with how the visual-level filters are applied. Remember, visual-level filters will only affect the data displayed within that specific visual and not the slicer's operation itself.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thanks Team_Binbin Yu I founded the issue was in switch condition last sentence equal to 0...