Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Solved! Go to Solution.
@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] ) )
@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.
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
@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.
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
Thanks!
Any idea how do I make user just to select one value, either Yes or No.
@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] ) )
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |