Forum Discussion
Jesskim96
2 years agoFrequent Visitor
Slicer sections are being ignored within an if statement
I'm new to Power BI and I'm trying to create a flag to indicate if an employee was still active during a particular year (which is chosen by a slicer selection). I have a date table which contains ...
- Anonymous2 years ago
Hi Jesskim96 ,
Based on your description, you can try transforming Active Employee into a MEASURE, which will take effect, here is my formula and resultsActive Employee = IF( SELECTEDVALUE('Leaving Date'[Leave Date]) < [Max Date], "No", "Yes" )Best regards,
Albert HeIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Jesskim96
2 years agoFrequent Visitor
Hi Albert,
In addition to this, if I wanted to show the total number of "Yes" employees, how would I do this? If I do a count in a KPI then this doesn't take into account the row wise calculation of active employees.
Thanks!
Anonymous
2 years agoNot applicable
Hi Jesskim96 ,
You can create a measure
Total of Yes =
VAR _t =
SUMMARIZE(
'Leaving Date',
'Leaving Date'[Employee Number],
'Leaving Date'[Leave Date],
"Max Date",[Max Date],
"Yes/No",IF([Active Employee] = "Yes",1,0)
)
RETURN
SUMX(_t,[Yes/No])
Final output
Best regards,
Albert He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
- Jesskim962 years agoFrequent Visitor
This is great, thank you!