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

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

Reply
kjani
Helper I
Helper I

DAX formula to summarize a DirectQuery Table

I have connected to a large fact table in Amazon Redshift via DirectQuery. This table has details for each day. The query runs very slow. So, I want to summarize the table by month and build an aggregate table that can be imported locally. I am very new to DAX and don't know how to summarize day column (yyyymmdd format) to month column (yyyymm) and build a new summarized fact table. Please help. Thanks

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

Hi @kjani ,

 

We can use the following steps to meet your requirement. First you need to transform Direct Query to Import.

 

1. Add a yyyymm column in table using Power Query Editor.

 

Number.ToText(Date.Year([Date]))
&"-"&
Number.ToText(Date.Month([Date]))

 

DAX1.jpg

 

2. Then group by Custom column and the result like this,

 

DAX2.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

5 REPLIES 5
v-zhenbw-msft
Community Support
Community Support

Hi @kjani ,

 

We can use the following steps to meet your requirement. First you need to transform Direct Query to Import.

 

1. Add a yyyymm column in table using Power Query Editor.

 

Number.ToText(Date.Year([Date]))
&"-"&
Number.ToText(Date.Month([Date]))

 

DAX1.jpg

 

2. Then group by Custom column and the result like this,

 

DAX2.jpg

 

If you have any question, please kindly ask here and we will try to resolve it.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

Hi @kjani ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution.

 

Best regards,

 

Community Support Team _ zhenbw

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

parry2k
Super User
Super User

@kjani can you summarize at redshift and use that instead of summarizing in power bi, if you summarize in power bi, it is going to upload all the data and then perform summarization, why not do it at the source.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I don't have that option. 

@kjani I don't know how then you are going to take advantage of this summarize table, although I'm not sure if query folding for Redshift data source happens, if it does then you can use group by in power query to summarize your data, you can test that and see if it improve the performance.

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.