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
SO
Helper III
Helper III

Help with Attendance Visualizations using Tree Maps and Measures

Hello,

 

I need a little help trying to create a few attendance tracking visuals and ran into a challenge. 

 

I have following fields:  Person, CalendarDate, AbsReason, TotalAbs, Shift, Location, etc.   

 

I'm trying to show:

  1. a Treemap to show the range of total absences (e.g., a Visual that cluster the number of people with 1, 2, 3, 4, etc. absences)
  2. The number of people with specific attendance totals (e.g. # of Persons with '5, 10, 15, etc.'  absences)

My challenge is with number 1 that I'm trying to build using a TreeMap.  

 

Attendance is typcially recorded twice - morning and afternoon and is typically recorded as 0.5 each time.

A mock of my data would be like:   

Person          Date               TotalAbs            

1              Oct 5, 2020             0.5

1              Oct 6, 2020            1.0

1              Oct 7, 2020            1.0

1              Oct 8, 2020            0.5

2              Oct 5, 2020            0.5

2              Oct 6, 2020            0.5

2              Oct 7, 2020            0.5

2              Oct 8, 2020            0.5

5              Oct 5, 2020            1.0

5              Oct 6, 2020            1.0

5              Oct 7, 2020            1.0

5              Oct 8, 2020            1.0

5              Oct 9, 2020            1.0

5              Oct 12, 2020          1.0

5              Oct 13, 2020          1.0

5              Oct 14, 2020          1.0

5              Oct 15, 2020          1.0

5              Oct 16, 2020          1.0    

5              Oct 19, 2020          1.0

5              Oct 20, 2020          1.0

5              Oct 21, 2020          1.0

5              Oct 22, 2020          1.0

5              Oct 23, 2020          1.0

9              Oct 5, 2020            0.5

9              Oct 6, 2020            1.0

9              Oct 7, 2020            1.0

9              Oct 8, 2020            1.0

9              Oct 9, 2020            1.0

9              Oct 12, 2020          0.5

9              Oct 13, 2020          1.0

9              Oct 14, 2020          1.0

9              Oct 14, 2020          0.5

9              Oct 15, 2020          0.5

9              Oct 16, 2020          0.5   

 

If I add the 'Shift' field to the table, I then have

 

Person          Date               TotalAbs       Shift        

1              Oct 5, 2020             0.5             am

1              Oct 6, 2020             0.5             am

1              Oct 6, 2020             0.5             pm

1              Oct 7, 2020             0.5             am

1              Oct 7, 2020            0.5              pm

1              Oct 8, 2020            0.5              am

1              Oct 8, 2020            0.5             am

 

etc etc etc 

 

My first challenge pertains to a TreeMap, which I've used successfully a number of times.  

 

I can drag the TotalAbs to the Group, but it only shows those that have 0, 0.5 or 1.   When I use TotalAbs in the 'group' field, there is no option of 'summing, counting, etc ' the TotalAbs.   I created an measure that counted the TotalAbs but could not drag this measure into the Group Field of the TreeMap.   

 

Thoughts?

 

SO_0-1603893325381.png

 

My Map shows everyone with 0.5 or 1 absence in two large groups, whereas, I am looking to cluster people into groups of 1,2,3,4,5,6,7, etc.  

 

I will work on how to reduce this specific totals e.g., 5,10,15 once I can figure out what I'm doing incorrectly. 

 

FYI: here was one of a few Meaures that I experimented with.  

 

Measure running total in TotalAbs =
CALCULATE(
    SUM('AttendTable'[TotalAbs]),
    FILTER(
        ALLSELECTED('AttendTable'[TotalAbs]),
        ISONORAFTER('AttendTable'[TotalAbs], MAX('AttendTable'[TotalAbs]), DESC)
    )
)

 

 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hello @SO ,

You cannot use TotalABS has a group field in the tree map because the values have 1 and 0.5.

You must create a new table with the groupings you need in my case I created the following table:

Category table = GENERATESERIES(0,5 ; 100 ; 0,5)

This will generate a table with all values between 0.5 and 100 with the value 0.5 in the range:

MFelix_0-1604406043010.png

TotalCount =
VAR temp_table =
    SUMMARIZE (
        ALLSELECTED ( 'Table'[Person] );
        'Table'[Person];
        "@Totalabsvalue"; SUM ( 'Table'[TotalAbs] )
    )
RETURN
    COUNTROWS (
        FILTER (
            temp_table;
            [@Totalabsvalue] = SELECTEDVALUE ( 'Category table'[Value] )
        )
    )

In the example that you place I added another user with similar data has user 9 result is down and in attach PBIX file.

MFelix_1-1604406274681.png


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hello @SO ,

You cannot use TotalABS has a group field in the tree map because the values have 1 and 0.5.

You must create a new table with the groupings you need in my case I created the following table:

Category table = GENERATESERIES(0,5 ; 100 ; 0,5)

This will generate a table with all values between 0.5 and 100 with the value 0.5 in the range:

MFelix_0-1604406043010.png

TotalCount =
VAR temp_table =
    SUMMARIZE (
        ALLSELECTED ( 'Table'[Person] );
        'Table'[Person];
        "@Totalabsvalue"; SUM ( 'Table'[TotalAbs] )
    )
RETURN
    COUNTROWS (
        FILTER (
            temp_table;
            [@Totalabsvalue] = SELECTEDVALUE ( 'Category table'[Value] )
        )
    )

In the example that you place I added another user with similar data has user 9 result is down and in attach PBIX file.

MFelix_1-1604406274681.png


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.