Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
javieregh
Frequent Visitor

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)

javieregh_0-1715364888797.png

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
)
1 ACCEPTED SOLUTION
javieregh
Frequent Visitor

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

View solution in original post

2 REPLIES 2
javieregh
Frequent Visitor

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

v-binbinyu-msft
Community Support
Community Support

Hi @javieregh ,

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.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.