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
SantoshKumar
Microsoft Employee
Microsoft Employee

Create a measure to restrict to do summation when only two fields in the Slicer are selected.

I have below table data :

 Area     Region    Role            Type         Year   Offshore  Onshore  Total

Area1Region1DeveloperNon-ATC2022112
Area1Region1TesterATC202215116
Area2Region1TesterATC2022303
Area2Region1TesterNon-ATC2022101
Area2Region2DeveloperNon-ATC2022022
Area2Region2TesterATC202213013
Area3Region1TesterATC2022055
Area3Region3TesterATC2022404
Area3Region2DeveloperNon-ATC2022011
Area3Region2TesterATC2022055
Area3Region4TesterATC2022055

 

I want to apply a condition only when i select a selection such as :
Area= Area 3 and Region = Region2 & Region4 => then the data should show only values of Region2 instead of SumofRegion2& Region4.

for  else statement, it should work as normal.

Below is the snapshot of the visualization:

 

SantoshKumar_0-1666306069580.png

SantoshKumar_1-1666306093200.png

Instead of 10 it should show only 5 when Region2 and Region4 are selected.


 

1 ACCEPTED SOLUTION

@SantoshKumar Maybe try constructing measures for Offshore, Onshore and Total like this:

Onshore Measure = 
    VAR __Area = SELECTEDVALUE('Table'[Area])
    VAR __Regions = DISTINCT('Table'[Region])
RETURN
    IF(
        __Area = "Area3" && "Region2" IN __Regions && "Region4" IN __Regions,
        SUMX(FILTER('Table',[Region] = "Region2"),[Onshore]),
        SUM('Table'[Onshore])
    )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@SantoshKumar Is it specifically for the case of Region2 and Region4 or is the logic if 2 are selected then display the minimum one or ?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler , I need to apply condition only :
when my selection is 1) Area as Area3 and 2) when i select region2 and Region4 together then it should display value of (Area3 ->Region2 only)

and for rest of them, it should be normal expected values only.

@SantoshKumar Maybe try constructing measures for Offshore, Onshore and Total like this:

Onshore Measure = 
    VAR __Area = SELECTEDVALUE('Table'[Area])
    VAR __Regions = DISTINCT('Table'[Region])
RETURN
    IF(
        __Area = "Area3" && "Region2" IN __Regions && "Region4" IN __Regions,
        SUMX(FILTER('Table',[Region] = "Region2"),[Onshore]),
        SUM('Table'[Onshore])
    )

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Its worked for me. Thanks for the Help.

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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