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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
SyedAli
Frequent Visitor

Aggregations not working with Date Table when using Azure SQL Data Warehouse

Hi,

 

I am trying to build an aggregation table which can work along side with Direct Query using Azure SQL Data Warehouse as source.

The same logic worked well when I used source as Sparks.

 

However it is not working same with source as Azure SQL Data Warehouse.

I already implemented aggregations many times so it is not new for me however it is new as Azure SQL Data Warehouse as source.

 

Below is the Query showing in performance analyzer and the performance is very slow.

I really don't understand why the second query is sending extra //SQL Query which is degrading the performance.

 

Appreciate your kind support. Thanks.

 

1 - Query sending from Table source as Sparks:

// DAX Query
EVALUATE
TOPN(
502,
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP('DateTimeTable'[Year], 'DateTimeTable'[MonthNameShort], 'DateTimeTable'[Day]), "IsGrandTotalRowTotal"
),
"CountId", CALCULATE(COUNTA('Table1'[Id]))
),
[IsGrandTotalRowTotal],
0,
[CountId],
0,
'DateTimeTable'[Year],
1,
'DateTimeTable'[MonthNameShort],
1,
'DateTimeTable'[Day],
1
)

ORDER BY
[IsGrandTotalRowTotal] DESC,
[CountId] DESC,
'DateTimeTable'[Year],
'DateTimeTable'[MonthNameShort],
'DateTimeTable'[Day]

 

2 - Query sending from Table source as Azure SQL Data Warehouse:

// DAX Query
EVALUATE
TOPN(
502,
SUMMARIZECOLUMNS(
ROLLUPADDISSUBTOTAL(
ROLLUPGROUP('DateTimeTable'[Year], 'DateTimeTable'[MonthNameShort], 'DateTimeTable'[Day]), "IsGrandTotalRowTotal"
),
"CountId", CALCULATE(COUNTA('Table1'[Id]))
),
[IsGrandTotalRowTotal],
0,
'DateTimeTable'[Year],
1,
'DateTimeTable'[MonthNameShort],
1,
'DateTimeTable'[Day],
1
)

ORDER BY
[IsGrandTotalRowTotal] DESC,
'DateTimeTable'[Year],
'DateTimeTable'[MonthNameShort],
'DateTimeTable'[Day]


// SQL Query

SELECT
TOP (1000001) [t18].[DateTime],
COUNT_BIG([t18].[Id])
AS [a0]
FROM
(
(select [$Table].[Id] as [Id],
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
[$Table].columnname as columname
from [dbo].[Table1] as [$Table])
)
AS [t18]
GROUP BY [t18].[DateTime]

2 REPLIES 2
v-xicai
Community Support
Community Support

Hi @SyedAli ,

 

The aggregated table can be created in the data source with T-SQL queries, or in Power Query, or anywhere else that you can create a grouped table.

 

You can learn more :

https://radacad.com/power-bi-aggregation-step-1-create-the-aggregated-table,

https://radacad.com/power-bi-aggregations-step-3-configure-aggregation-functions-and-test-aggregatio...,

https://docs.microsoft.com/en-us/power-bi/desktop-aggregations

 

Best Regards,

Amy

 

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

Hi @v-xicai ,

 

Thanks for your response, I am able to create the aggregations without any issues.

 

What I am experirencing is when I used DATE Table to get the count it is converting treating it as DirectQuery instead of pointing to aggregated table.

 

Thanks

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.