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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Add Columns Union

Hi,
I would like to add month (highlighed in Red) into my table if possible within the existing logic (highlighted in Black), any idea how I would I go about doing this please?

I have tried to copy the logic down, but can't get the syntax to work, or, my months and year column append rather than having 1 column for year and another for month. 

Volumes = 
ADDCOLUMNS(ADDCOLUMNS(DISTINCT(UNION(
SELECTCOLUMNS(VALUES(Mort[Mort_Year]),"Year",Mort[Mort_Year]),
SELECTCOLUMNS(VALUES(Comp[Comp_year]),"Year",Comp[Comp_year]))),
SELECTCOLUMNS(VALUES(Mort[Mort_month]),"month",Mort[Mort_month]),
SELECTCOLUMNS(VALUES(Comp[Comp_month]),"month",Comp[Comp_month))),

 

"Mort_vol",SUMX(FILTER(Mort,Mort[Mort_Year]=EARLIER([Year])),Mort[Mort_Count])),
"Comp_vol",SUMX(FILTER(Comp,Comp[Comp_year]=EARLIER([Year])),Comp[Mort_Count]))
"Mort_vol",SUMX(FILTER(Mort,Mort[Mort_month]=EARLIER([month])),Mort[Mort_Count])),
"Comp_vol",SUMX(FILTER(Comp,Comp[Comp_month]=EARLIER([month)),Comp[Mort_Count]))

This is how I would like my table to output. Any help on this would be much appreciate, thank you. 

1 REPLY 1
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

Not sure what's your Mort & Comp table (data, structure, table relationship), it seems that you can try UNION(), SELECTCOLUMNS(), RELATED() function.

See the tutorial for how to use it, 

1. RELATED()

vxiaotang_0-1635129308779.png

2. UNION()

3. SELECTCOLUMNS()

 

 

 

Best Regards,

Community Support Team _Tang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.