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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
NYS
New Member

DAX command - to group number of issues in students

Hi,

Thank you so much for helping. I'm in a university as an advisory faculty to student issues. 

Here's the data I loaded into Power BI:

 

Table 1

NameIssues
DavidAcademic
DavidPsychosocial
DavidFinancial
BettyAcademic
BettyPyschosocial
JohnAcademic
JohnFinancial
RachelPsychosocial
RachelProfessional
FredAcademic
CindyAcademic
GeorgePsychosocial
EllaFinancial
SimonProfessional

 

I have no problems doing this:

IssuesNumber of Students
Academic5
Psychosocial4
Financial3
Professional2

What I did was to create a measure: Count = COUNTROWS(Table1)

Then I selected Table in Visualisation, clicked on Issues and the new measure Count (like the graphic below) and it returns the table above:

 

NYS_0-1703684117051.png 

 

But what I really want to do is to construct a Table 2 from Table 1 to count how many students have how many issues: like this:

Table 2

Number of IssuesNumber of Students
31
23
15

 

What measures or columns in DAX do I create so that I can click them to get the table 2 visualization?

Thank you so much! This is driving me mad!

 

YS, Ng 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @NYS 

 

You can try the following methods.

Table:

Table2 = SUMMARIZE('Table1','Table1'[Name],"Count Name",CALCULATE(COUNT('Table1'[Name]),ALLEXCEPT('Table1','Table1'[Name])))

Column:

Number of Students = CALCULATE(COUNT(Table2[Count Name]),ALLEXCEPT(Table2,Table2[Count Name]))
Number of Issues = CALCULATE(COUNT('Table1'[Issues]),FILTER('Table1',[Name]=EARLIER(Table2[Name])))

vzhangti_0-1703749833140.png

vzhangti_1-1703749891262.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @NYS 

 

You can try the following methods.

Table:

Table2 = SUMMARIZE('Table1','Table1'[Name],"Count Name",CALCULATE(COUNT('Table1'[Name]),ALLEXCEPT('Table1','Table1'[Name])))

Column:

Number of Students = CALCULATE(COUNT(Table2[Count Name]),ALLEXCEPT(Table2,Table2[Count Name]))
Number of Issues = CALCULATE(COUNT('Table1'[Issues]),FILTER('Table1',[Name]=EARLIER(Table2[Name])))

vzhangti_0-1703749833140.png

vzhangti_1-1703749891262.png

Is this the result you expect? Please see the attached document.

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Fowmy
Super User
Super User

@NYS 

Create a new table to get the sequence to of count of students.

Table2 = 
 SELECTCOLUMNS(
    GENERATESERIES( 1 , DISTINCTCOUNT( Table1[Name] ) ),
    "Student Count" , [Value] 
 )


Create the collowing meaure, using it on a table visual with the previous table column.

Fowmy_0-1703685938421.png

Issue Count = 
VAR __Std = SELECTEDVALUE( Table2[Student Count] )
RETURN
COUNTROWS(
    FILTER(
        ADDCOLUMNS(
            SUMMARIZE( Table1 , Table1[Name] ),
            "Count" , CALCULATE( COUNT( Table1[Issues] ) )
        ),
        [Count] = __Std
    )
)


File is attached



Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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