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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
WishAskedSooner
Continued Contributor
Continued Contributor

How to build a flat table in a Report

Hi Experts!

 

I am trying to find a way to present the underlying data to users in a Report as a flattened table. For example, if I have the following fact table:

 

StudentClassCourseGrade
AkashSophomoreMathA
DaveSeniorMathB
AkashSophomoreEnglishA
DaveSeniorEnglishC
AkashSophomoreHistoryB
DaveSeniorHistoryA

 

I want to pivot on the Course with Max Grade as values. Think how the PQ command works:

 

Table.Pivot( MyTable, List.Distinct( MyTable[Course] ), "Course", "Grade", List.Max )

 

StudentClassMathEnglishHistory
AkashSophomoreAAB
DaveSeniorBCA

 

However, I can't figure out how to do this using PowerBI visuals because the Courses are dynamic as they are added and deleted all the time making Tables problematic. Plus, this is just an example. My actual fact table has several hundred columns.

 

Also, I don't want a collapsable hierarchy like in a matrix. I just want a flattened table like the above even with NULLS.

 

Then finally, I want to add a few slicers to the Report.

 

I looked at Paginated Reports, but this is not what I am after either.

 

Any thoughts? TIA!

1 ACCEPTED SOLUTION

I think I figured it out. I need to change the Layout for a Matrix to Tabular. That seems to work!

WishAskedSooner_0-1745677118655.png

 

View solution in original post

3 REPLIES 3
Sahir_Maharaj
Super User
Super User

Hello @WishAskedSooner,

 

Can you please try this approach:

GradeValue = 
MAX( 'FactTable'[Grade] )
PivotedTable = 
SUMMARIZE(
    'FactTable',
    'FactTable'[Student],
    'FactTable'[Class],
    "Math", CALCULATE( MAX('FactTable'[Grade]), 'FactTable'[Course] = "Math" ),
    "English", CALCULATE( MAX('FactTable'[Grade]), 'FactTable'[Course] = "English" ),
    "History", CALCULATE( MAX('FactTable'[Grade]), 'FactTable'[Course] = "History" )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ About: https://sahirmaharaj.com/about.html
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

@Sahir_Maharaj 

 

Thank you so much for you quick reply!

 

I tried your solution. I created a new table using your PivotedTable DAX statement. Then, I loaded all the columns of the table into a Table Visual. I was even able to add a slicer.

WishAskedSooner_1-1745676535023.png

A couple of questions regarding your solution.

 

First, I don't see where the first measure, GradeValue, comes in.

 

Second, this requires me to hard code the Courses using DAX, yuck! My actual fact table has several hundred columns. If this really is the only way, then I would pivot my fact table using PQ, but I would then need to hand drag those several hundred columns into the Table Visual. I am hesitant to even try this because for all I know, it would break PBI.

 

Also, the Courses offered change from year to year. For example, if I have a slicer for year, and "Physics" is not offered in that year, I don't want it in my table.

 

I can almost build what I need with a matrix. The main problem is I don't want a collapsable hierarchy. Maybe there is a setting to turn it off? But, I can't find one.

 

WishAskedSooner_0-1745676472068.png

Your thoughts?

I think I figured it out. I need to change the Layout for a Matrix to Tabular. That seems to work!

WishAskedSooner_0-1745677118655.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors