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.
Problem: I wanted to find out how many unique employees worked each day. However, the total for distinctcount will only be unique employees for the entire period and not each day.
Solution:
VAR SummarizeTry = Summarize(LaborTable,LaborTable[EmpNo],LaborTable[DateWorked],"Count1",Distinctcount(EmpNo))
Return SUMX(SummarizeTry,[Count1])
As I understand it, Summarize is taking my data and creating a new table. In this table, Power BI is doing the same thing as if I went into the powery query and clicked transform --> group by Emp No and Date Worked. Finally, it creates a measure called Count1 which is a distinct count of the newly grouped table to count the unique entries for each employee for each day.
The SUMX will go line by line and add up the employee count for each day. Is my understanding correct?
Solved! Go to Solution.
Hi @dyee4613
That's pretty much how it works, yeah, but do note that all values in the Count1 column will be 1, since you are counting over one employee and one day. I'm not sure that's what you are after. You can see the the table produced by summarize directly by creating a new calculated table with the code:
NewTable = SUMMARIZE ( LaborTable, LaborTable[EmpNo], LaborTable[DateWorked], "Count1", DISTINCTCOUNT ( LaborTable[EmpNo] ) )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
Hi @dyee4613
That's pretty much how it works, yeah, but do note that all values in the Count1 column will be 1, since you are counting over one employee and one day. I'm not sure that's what you are after. You can see the the table produced by summarize directly by creating a new calculated table with the code:
NewTable = SUMMARIZE ( LaborTable, LaborTable[EmpNo], LaborTable[DateWorked], "Count1", DISTINCTCOUNT ( LaborTable[EmpNo] ) )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Cheers
User | Count |
---|---|
16 | |
13 | |
12 | |
11 | |
10 |
User | Count |
---|---|
19 | |
16 | |
15 | |
11 | |
9 |