Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I have a nest calculation that needs a filter statement on it with an in statement can anyone help me figure out why this is not working?
Industry Average =
VAR Slicer =
SELECTEDVALUE ( 'Benchmark Slicer'[Slicer] )
VAR Fail_Count =
CALCULATE (
COUNT ( 'SafetyRpts JobData'[SubCategoryName] ),
'SafetyRpts JobData'[ItemPassFail] = "F"
&& 'SafetyRpts JobData'[ImmediatelyCorrected] = "Y"
)
VAR Pass_Count =
CALCULATE (
COUNT ( 'SafetyRpts JobData'[SubCategoryName] ),
'SafetyRpts JobData'[ItemPassFail] = "P"
)
VAR Result =
SWITCH (
TRUE (),
Slicer = "Regional",
CALCULATE (
DIVIDE (
IF (
AND (
MAX ( 'SafetyRpts JobData'[ItemPassFail] ) = "F",
MAX ( 'SafetyRpts JobData'[ImmediatelyCorrected] ) = "Y"
)
|| MAX ( 'SafetyRpts JobData'[ItemPassFail] ) = "P",
Fail_Count + Pass_Count
),
CALCULATE ( COUNT ( 'SafetyRpts JobData'[SubCategoryName] ) ),
FILTER (
VALUES ( 'SafetyRpts InspectionData' ),
'SafetyRpts InspectionData'[AccountName] = ( [Find Client Region] )
)
),
Slicer = "Inpector",
(
CALCULATE (
DIVIDE (
IF (
AND (
MAX ( 'SafetyRpts JobData'[ItemPassFail] ) = "F",
MAX ( 'SafetyRpts JobData'[ImmediatelyCorrected] ) = "Y"
)
|| MAX ( 'SafetyRpts JobData'[ItemPassFail] ) = "P",
Fail_Count + Pass_Count
),
CALCULATE ( COUNT ( 'SafetyRpts JobData'[SubCategoryName] ) )
)
)
),
Slicer = "Global",
(
CALCULATE (
DIVIDE (
IF (
AND (
MAX ( 'SafetyRpts JobData'[ItemPassFail] ) = "F",
MAX ( 'SafetyRpts JobData'[ImmediatelyCorrected] ) = "Y"
)
|| MAX ( 'SafetyRpts JobData'[ItemPassFail] ) = "P",
Fail_Count + Pass_Count
),
CALCULATE ( COUNT ( 'SafetyRpts JobData'[SubCategoryName] ) )
)
)
)
)
)
RETURN
Result
Hi @TariqArnabi
Thanks for reaching out to us.
Please return each variable in turn to check whether the return value is correct. If there is no problem with their return values, could you please provide some sample data for us to investigate further? Thanks
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
8 | |
7 |
User | Count |
---|---|
13 | |
12 | |
11 | |
11 | |
8 |