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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Combine two columns in visual

Hello Everyone,

 

I want to ask if it is possible to combine two columns in a column chart without changing the underlying data.

 

Luca1234_0-1644493573171.png

For example as shown in the picture. I have two columns that are seperate because of the way the category is saved in the source table. Because they are basically the same I want to combine them, so I have one column with 7 entries and only one of the category titles. It needs to be done in the visual because I cant change the source data.

 

Thanks for any help on this. maybe its not possible also.

 

@Greg_Deckler 

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

Hi, @Anonymous 

 

Result:

vangzhengmsft_0-1644909291838.pngTry to create the following measures:

cat = 
var _currentCat=MAX('Table'[category]) 
var _lenth=LEN(_currentCat)
var _delimiter=SEARCH(",",_currentCat,1,-1)
var _cat1=left(_currentCat,_delimiter-1)
var _cat2=RIGHT(_currentCat,_lenth-_delimiter)
var _cat=CONCATENATE(MIN(_cat1,_cat2),MAX(_cat1,_cat2))

return _cat
_Sum = 
var _currentCat=MAX('Table'[category]) 
var _lenth=LEN(_currentCat)
var _delimiter=SEARCH(",",_currentCat,1,-1)
var _cat1=left(_currentCat,_delimiter-1)
var _cat2=RIGHT(_currentCat,_lenth-_delimiter)
var _cat=CONCATENATE(MIN(_cat1,_cat2),MAX(_cat1,_cat2))

var _t=ADDCOLUMNS(ALL('Table'),"_cat",[cat])
var _sum=SUMX(FILTER(_t,[_cat]=_cat),[Value])

return _sum
_show = 
var _currentCat=MAX('Table'[category]) 
var _lenth=LEN(_currentCat)
var _delimiter=SEARCH(",",_currentCat,1,-1)
var _cat1=left(_currentCat,_delimiter-1)
var _cat2=RIGHT(_currentCat,_lenth-_delimiter)
var _cat=CONCATENATE(MIN(_cat1,_cat2),MAX(_cat1,_cat2))

var _t=ADDCOLUMNS(ALL('Table'),"_cat",[cat])
var _sum=SUMX(FILTER(_t,[_cat]=_cat),[Value])

var _OnlyShowOne=MINX(FILTER(_t,[_cat]=_cat),[category])
var _show=IF(_currentCat=_OnlyShowOne,1,0)
return _show

Then show items when _show is 1 in filter pane.
Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

View solution in original post

2 REPLIES 2
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

 

Result:

vangzhengmsft_0-1644909291838.pngTry to create the following measures:

cat = 
var _currentCat=MAX('Table'[category]) 
var _lenth=LEN(_currentCat)
var _delimiter=SEARCH(",",_currentCat,1,-1)
var _cat1=left(_currentCat,_delimiter-1)
var _cat2=RIGHT(_currentCat,_lenth-_delimiter)
var _cat=CONCATENATE(MIN(_cat1,_cat2),MAX(_cat1,_cat2))

return _cat
_Sum = 
var _currentCat=MAX('Table'[category]) 
var _lenth=LEN(_currentCat)
var _delimiter=SEARCH(",",_currentCat,1,-1)
var _cat1=left(_currentCat,_delimiter-1)
var _cat2=RIGHT(_currentCat,_lenth-_delimiter)
var _cat=CONCATENATE(MIN(_cat1,_cat2),MAX(_cat1,_cat2))

var _t=ADDCOLUMNS(ALL('Table'),"_cat",[cat])
var _sum=SUMX(FILTER(_t,[_cat]=_cat),[Value])

return _sum
_show = 
var _currentCat=MAX('Table'[category]) 
var _lenth=LEN(_currentCat)
var _delimiter=SEARCH(",",_currentCat,1,-1)
var _cat1=left(_currentCat,_delimiter-1)
var _cat2=RIGHT(_currentCat,_lenth-_delimiter)
var _cat=CONCATENATE(MIN(_cat1,_cat2),MAX(_cat1,_cat2))

var _t=ADDCOLUMNS(ALL('Table'),"_cat",[cat])
var _sum=SUMX(FILTER(_t,[_cat]=_cat),[Value])

var _OnlyShowOne=MINX(FILTER(_t,[_cat]=_cat),[category])
var _show=IF(_currentCat=_OnlyShowOne,1,0)
return _show

Then show items when _show is 1 in filter pane.
Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

Greg_Deckler
Community Champion
Community Champion

@Anonymous In theory you could create a measure like:

Measure =
  IF(
    MAX('Table'[Category] = "System2, System1",
    BLANK(),
    COUNTROWS(FILTER(ALL('Table'), [Category] = "System1, System2" || [Category] = "System2, System1"))
  )


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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