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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Svet_Dimov
Frequent Visitor

Design question fact table rows vs columns

I have a question regarding what would be a more optimal design of a directquery fact table. Currently I have a table in the following format:

  • timestamp
  • dimension
  • dimension_A_value (Null for all rows where dimension is not A)
  • dimension_B_value (Null for all rows where dimension is not B)
  • dimension_C_value (Null for all rows where dimension is not C)
  • ...
  • dimension_Z_value (Null for all rows where dimension is not Z)

In my visualizations I am using only one or two different dimensions with simple aggregation measures (SUM or MAX).

 

I was wondering if having the design of table changed to the one below would be more performant:

  • timestamp
  • dimension
  • value

For the visualizations I would use CALCULATE(SUM(value), dimension = "A") instead of SUM(dimension_A_value).

 

My gut feeling is that it would perform better, but I am new to using DirectQuery connections and I would appreciate the community's input.

3 REPLIES 3
Svet_Dimov
Frequent Visitor

Thanks a lot for the response, @Greg_Deckler! My main concern is that  I would be adding a CALCULATE function to the DAX and I am not sure if it has a performance Impact on the DirectQuery.

Hi @Svet_Dimov ,Greg_Deckler, thank you for your prompt reply!


The short answer is Yes, quoted from the official documentation:

 

At least initially, it's recommended to limit measures to simple aggregates.

 

The aggregate functions include SUM, COUNT, MIN, MAX, and AVERAGE.

 

Then, if the measures are sufficiently responsive, you can experiment with more complex measures, but paying attention to the performance for each.

 

While the Calculate DAX function can be used to produce sophisticated measure expressions that manipulate filter context, they can generate expensive native queries that don't perform well.

 

Best regards,

Joyce

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

Greg_Deckler
Super User
Super User

@Svet_Dimov I agree with you that the second format seems much better suited to how Power BI wants to see its data and *should* perform better and certainly shouldn't perform worse.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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