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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Suneer
Frequent Visitor

Dax Union - To Add a Static Column

I've generated a Union Query in DAX and included a static field named "MainAccount" (highlighted in red). This functionality functions correctly in Power BI. However, when I attempt to replicate the same in a paginated report, an error is encountered. The provided DAX query serves as an example. Assistance in resolving this issue would be greatly appreciated.

 

SampleTable1 = Union(
selectcolumns(SampleTable1,
"Company", SampleTable1[Company],
"Invoice Date", SampleTable1[InvoiceDate]
"MainAccount", "SalesAccount"),
selectcolumns(SampleTable2,
"Company", SampleTable2[Company],
"Invoice Date", SampleTable2[InvoiceDate],
"MainAccount", "CostAccount"))

3 REPLIES 3
Suneer
Frequent Visitor

I observed that when incorporating a static field in a DAX query within a paginated report, it should be positioned last. (see the mistake I did in the following example. The example i shown in the original post was correct )  . In my situation, I mistakenly positioned the static field between other fields.

Eg.

SampleTable1 = Union(
selectcolumns(SampleTable1,
"MainAccount", "SalesAccount",
"Company", SampleTable1[Company],
"Invoice Date", SampleTable1[InvoiceDate])
,
selectcolumns(SampleTable2,
"MainAccount", "CostAccount",
"Company", SampleTable2[Company],
"Invoice Date", SampleTable2[InvoiceDate]))

Hi @Suneer UNION "wants" proper column structure for underlying columns.

Check link for this functions https://learn.microsoft.com/en-us/dax/union-function-dax?WT.mc_id=DP-MVP-4025372 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






some_bih
Super User
Super User

Hi @Suneer 

for both  "SalesAccount" and  "CostAccount" you will need table reference (usually)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.