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

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.

Reply
smullan
Frequent Visitor

Employee Count by Month

Hi,

 

I have a field in Power BI that counts the total number of employees based on their employee number - this is captured every couple of days.

 

When I then filter this employee count by month, or even by year, it is unclear what count Power BI automatically selects. Does anyone know how Power BI selects a particular value for a month filter for example?

 

Thanks 

3 REPLIES 3
Anonymous
Not applicable

@smullan,

 

Could you show more details, please? I did not understand your problem. 

No problem, apologies for the confusion!

 

I have a table similar to the below in Power BI. If I select a matrix visual and put 'Headcount' in 'Values' and use the timeframe as the Column, selecting 'Month' in the Date Hierarchy, how does Power BI determine which headcount figure to pull in when, for example in January, there are 11 separate figures for this month?

 

HeadcountDate       
30026-Dec
30229-Dec
30101-Jan
38004-Jan
38307-Jan
39010-Jan
39113-Jan
38916-Jan
38919-Jan
39022-Jan
38025-Jan
38328-Jan
39031-Jan
39203-Feb
38806-Feb
38709-Feb
38812-Feb

 

Thanks

Anonymous
Not applicable

What are your columns data type? 

 

In my case, Headcount is Whole Number and Date is Date

TableTable

 If you are using the same type as my example, creating a Matrix visual and adding Headcount as Values and Month as Columns, you will get a visual like this:

image.png

 

image.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The sum for january is 4166, which is the sum of the eleven figures that you said. If you add Month and Day as columns and Expand all down on level in the hierarchy, you cand see the values:image.png

 

 

 

Now, if the column Headcount's type is text and you put it in the matrix' values, the predefined order is to order by first value. And what does it means? Take a look on this example:image.png

 

 

image.png

 

 

January has two distinct values for Headcount ( 222222 - 300000) and the first Headcount 222222.

December has tow distincts values for that column (111111 - 2) and the first Headcount is 111111.

 

This happens, since the values of Headcount are strings, it is ordered by lexicographical order.

 

You can read about lexicographical order here and here.

 

Hope it helps!

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.