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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Pivot measure based on the pivot row label grouping

Hi All

Below is a sample table for which a pivot needs to be created.

Capture1.JPG

 

 

 

 

 

Measure:
Err = IF(HASONEVALUE(Range[Group2]),0.11,IF(HASONEVALUE(Range[Group1]),0.03,0.02))

Capture3.JPGThe goal is to create Err as expected but it fails when context for Group1/Group2 gets filtered down to one value. Please fish me out of this problem I've been struggling with from past two days. Thanks in advance.

 

 

 

Thanks

Guru

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Try with isinscope

 

Measure:
Err = IF(isinscope(Range[Group2]),0.11,IF(isinscope(Range[Group1]),0.03,0.02))

 

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

 

Please try the below measure.

 

Err =

IF(ISFILTERED(Range[Group2]),0.11, IF(ISFILTERED(Range[Group1]), 0.03, 0.02))
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

5 REPLIES 5
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

 

Please try the below measure.

 

Err =

IF(ISFILTERED(Range[Group2]),0.11, IF(ISFILTERED(Range[Group1]), 0.03, 0.02))
 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Anonymous
Not applicable

Amazing!! I've been struggling from past two days and you all solved it like nothing. Is it possible to accept multiple answers as solutions? Have come to know that ISFILTERED can result in false positives hence accepting the reply from @amitchandak as the solution. Hope you understand. Thanks by the way for your quick response.

amitchandak
Super User
Super User

@Anonymous , Try with isinscope

 

Measure:
Err = IF(isinscope(Range[Group2]),0.11,IF(isinscope(Range[Group1]),0.03,0.02))

 

https://www.kasperonbi.com/use-isinscope-to-get-the-right-hierarchy-level-in-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

You really are a super man. Have searched lot of questions and most of them had your replies. And thanks a lot for the best possible solution. Somehow I'm unable to see ISINSCOPE while creating DAX measure.

Capture4.JPG

 

@Anonymous , Thanks. isfiltered is also driven by slicer values. Isinscope is not.  so depending on the need you can use it. 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors