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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

create static measure

Hi,

 

I am looking for creating a static measure with values 'Yes' and 'No'.

And based on the selection of the Yes or No, I want to out a case statement in another measure.

Following is what is to be achieved:

If SelectedValue = 'Yes', 

Measure1 =Sum( 'Table1'[countNumber] )

if SelectedValue = 'No', 

Measure1 =Sum( 'Table1'[countNumberExcluded] )

else 

Measure1 =Sum( 'Table1'[countNumber] )

 

Nothing can be done on the report view.

Please guide me achieving this.

Thanks in advance.

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , Create a table using enter Data and Have two Values Yes And No.

 

Keep it independent, means do not join with others

 

Then try a measure like

If(SelectedValue(Table[column]) ="Yes" ,Sum( 'Table1'[countNumber] ),Sum( 'Table1'[countNumberExcluded] ) )

 

Also refer:https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern

 

 

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

Greg_Deckler
Community Champion
Community Champion

@Anonymous A little hard to follow but in general for this you want to created a completely disconnected table with your values. So create a table using Enter Data and just have two rows "Yes" and "No" in Column1. 

Greg_Deckler_1-1600066449036.png

 

Greg_Deckler_0-1600066401947.png

Make sure that there are no relationships to this table.

 

Now, create a measure like this:

SelectedValue = SELECTEDVALUE('Table'[Column1)

Finally, create this measure:

Measure1 = 
  SWITCH(TRUE(),
    [SelectedValue] = "Yes",SUM( 'Table1'[countNumber] ),
    [SelectedValue] = "No", SUM( 'Table1'[countNumberExcluded] ),
    SUM( 'Table1'[countNumber] )
  )

 

 The technique is called the disconnected table trick and you can learn more about it here: In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563



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

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous A little hard to follow but in general for this you want to created a completely disconnected table with your values. So create a table using Enter Data and just have two rows "Yes" and "No" in Column1. 

Greg_Deckler_1-1600066449036.png

 

Greg_Deckler_0-1600066401947.png

Make sure that there are no relationships to this table.

 

Now, create a measure like this:

SelectedValue = SELECTEDVALUE('Table'[Column1)

Finally, create this measure:

Measure1 = 
  SWITCH(TRUE(),
    [SelectedValue] = "Yes",SUM( 'Table1'[countNumber] ),
    [SelectedValue] = "No", SUM( 'Table1'[countNumberExcluded] ),
    SUM( 'Table1'[countNumber] )
  )

 

 The technique is called the disconnected table trick and you can learn more about it here: In general, to use a measure in that way, you need to use the Disconnected Table Trick as this article demonstrates: https://community.powerbi.com/t5/Community-Blog/Solving-Attendance-with-the-Disconnected-Table-Trick/ba-p/279563



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...
Anonymous
Not applicable

Thanks!

 

Any idea how do I make user just to select one value, either Yes or No.

amitchandak
Super User
Super User

@Anonymous , Create a table using enter Data and Have two Values Yes And No.

 

Keep it independent, means do not join with others

 

Then try a measure like

If(SelectedValue(Table[column]) ="Yes" ,Sum( 'Table1'[countNumber] ),Sum( 'Table1'[countNumberExcluded] ) )

 

Also refer:https://radacad.com/change-the-column-or-measure-value-in-a-power-bi-visual-by-selection-of-the-slicer-parameter-table-pattern

 

 

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.