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
DAZYCO
New Member

Dynamic Groups for Attendance

Good day,

 

I've used other BI tools but am relatively new to Power BI.  Here's my challenge.

 

  • I'm working with Education data where my Attendnace fact table stores a record every day a student is absent.
  • I'm trying to create dynamic groups that calculate the range that a student falls in.
  • These ranges will have to be updated depending on what school year, grade, subject, etc is filtered on.
  • The ranges are 0 days, 1-5 days, 6-10 days, 11-20 Days, 20+ Days

I created a lookup table that can be used in the calculation.

Elementary Attendance Days Absent Range

Elementary Attendance Days Absent Range.png

 

Here's the DAX expression I'm trying to use.  Note that [Elementary Attendance Students] is a distinct count of student numbers.

Days Absent Range = 
VAR AgeRangeDimension = VALUES('D: Student'[OEN])

RETURN
CALCULATE ([Elementary Attendance Students], 
    FILTER ( AgeRangeDimension, 
        COUNTROWS(
            FILTER('Elementary Attendance Days Absent Range', 
                RANKX( ALL   ('D: Student'[OEN] ), 'M: Elementary Attendance'[Days Absent], , DESC ) > 'Elementary Attendance Days Absent Range'[Min Days] 
                && RANKX(ALL ('D: Student'[OEN] ), 'M: Elementary Attendance'[Days Absent], , DESC ) <= 'Elementary Attendance Days Absent Range'[Max Days] ) ) > 0
            )
        )

When I use this column in a dashboard, I just get the value of large number which I beliegve is just summing all of the stduents.  Here are the questions that I'm hoping you can help with.

 

  1. What do I need to do to in the expression above to return the Range column from the lookup table?  Ideally I'd like to see 1 - 5 Days, 6 - 10 Days, etc returned.
  2. Should this calculation be a column or measure?
  3. Does it matter if the calculation above exits in the fact table or should I create it in a standalone table?

 

Thanks a lot for your help;

Dave

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@DAZYCO,

 

You may refer to the following post.

https://community.powerbi.com/t5/Desktop/Create-a-bar-graph-with-measures-as-axis/td-p/455900

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@DAZYCO,

 

You may refer to the following post.

https://community.powerbi.com/t5/Desktop/Create-a-bar-graph-with-measures-as-axis/td-p/455900

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.