Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am trying to total the number of days when a person is absent for both the am and the pm (on the same day) over a period of time based on multiple filters using a number of slicers.
In essence
Person# Date Period Abs Type
1 9/1/2019 am sick
1 9/1/2019 pm sick
2 9/1/2019 am sick
1 9/2/2019 am sick
1 9/3/2019 am personal
1 9/3/2019 pm personal
2 9/3/2019 pm personal
1 9/4/2019 am sick
1 9/5/2019 am sick
1 9/8/2019 am sick
1 9/8/2019 pm sick
2 9/8/2019 pm sick
2 9/9/2019 pm sick
2 9/10/2019 pm sick
I can create a measure to count either the "am" or the "pm" but not both (aka 'and' or '&&').
For example, I can create a measure to count the morning absences.
Person# Date Period Abs Type #absent
1 9/1/2019 am sick 1.0
1 9/2/2019 am sick 1.0
1 9/3/2019 am personal 1.0
1 9/4/2019 am sick 1.0
1 9/5/2019 am sick 1.0
1 9/8/2019 am sick 1.0
___________________________________________________________________
Total 1.0
So I created a new measure
Person# Date #absent
1 9/1/2019 1.0
1 9/3/2019 1.0
1 9/8/2019 1.0
Much appreciated for any thoughts?
Thanks again
Solved! Go to Solution.
So you want total at the end of table ?
if yes
then try something like this
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
check my blog here
https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/91...
Hi @SO
try a measure
#absent =
var _countAbsByDay = if(calculate(COUNTROWS('Table');ALLEXCEPT('Table';'Table'[Person#];'Table'[Date]);'Table'[Period]="am")>0;1;0) + if(calculate(COUNTROWS('Table');ALLEXCEPT('Table';'Table'[Person#];'Table'[Date]);'Table'[Period]="pm") >0;1;0)
return
if(_countAbsByDay=2;1;0)
do not hesitate to give a kudo to useful posts and mark solutions as solution
why don't you try simle distinct count measure like this
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
check my blog here
https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/91...
Dear Parvin,
Thank you so much for your help. Your code works great for 90 % of my issue (aka the chart)! The part that I still can't seem to resolve now is the total. The table does still shows a total of (1).
Do I need to create a new measure to sum this measure? I tried using Full Absence Total = MAXX('Table', New Text Document[#full absence]) without success. Thoughts?
FYI: Your code is similar to the code propose earlier, but simpler and with the extra instruction about setting the measure to 1.
Again - So many thanks !
So you want total at the end of table ?
if yes
then try something like this
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar
If I resolve your problem Mark it as a solution and give kudos.
check my blog here
https://community.powerbi.com/t5/Community-Blog/Connecting-to-a-Tabular-Model-Using-Power-BI/ba-p/91...
Hello again Parvin,
After sometime, the data set became so large that your first solution worked great, but started to slow down
User | Count |
---|---|
16 | |
15 | |
14 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
10 |