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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.