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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
NKAnalyst
Frequent Visitor

Add previous year comparison to table for several metrics

Hello,

I am trying to create a table like this excel table in PowerBi:

NKAnalyst_0-1632212028640.png

Units sold, Turnover and Market Share all come from different tables, which are connect via a Date and Country table.

I added Country to Column and Units sold, Turnover, Market Share to Value. Afterwards I turned "show on rows" on to have my Metrics shown in rows rather than in columns. No I am stuck with the %change last month column. I created calculated metrics for units sold, turnover, marketshare, however if I pull them in they show up below units sold, turnover, market share.

NKAnalyst_1-1632212673302.png


Any ideas how I can add one column per country which is giving me the %change for each metric?

Any help is highly appreciated!

1 ACCEPTED SOLUTION

Hi  @NKAnalyst ,

 

Summarize uses the same table,you cant add more tables in the function,you could use Addcolumns instead.

Pls pay attention to the syntax:

https://docs.microsoft.com/en-us/dax/summarize-function-dax

https://docs.microsoft.com/en-us/dax/addcolumns-function-dax

 

Best Regards,
Kelly

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

View solution in original post

6 REPLIES 6
NKAnalyst
Frequent Visitor

Hi @v-kelly-msft  and @amitchandak ,

First of all apologizes for all the questions I am quite a newby to PowerBi.

I think I found out what the problem is: units sold, market share etc are all measures I created and not columns. I messed this up - sorry  

If I move all the measures into on table (i.e 'Dax measures') the first summarize command works. However i dont have the Country dimension in this table there then (since it is coming from another table, i.e 'Dim_country')

 

If I try the second example:
union(
summarize('Dax measures','Dim_country'[country],"Revenue","sales","This period",[Revenue YTD],"Last period",[Revenue LYTD],"POP",[Revenue YOY])
summarize('Dax measures','Dim_country'[country],,"Costs","unit","This period",[Costs YTD],"Last period",[Costs LYTD],"POP",[Costs YOY])
)
PowerBi does not recognize the country table (I assume because there is no relationship betwenn "Dax measure" an "Dim Country". 

Given the new setting any idea what I could do to get a tabel with all measure split by country?

best regards

Hi  @NKAnalyst ,

 

Summarize uses the same table,you cant add more tables in the function,you could use Addcolumns instead.

Pls pay attention to the syntax:

https://docs.microsoft.com/en-us/dax/summarize-function-dax

https://docs.microsoft.com/en-us/dax/addcolumns-function-dax

 

Best Regards,
Kelly

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

amitchandak
Super User
Super User

@NKAnalyst , this is measure split to dimension. With all the dimensions you need as the filter you need to create a table like

 

example

union(
summarize('Table',"Measure","sales","This period",[SALES YTD],"Last period",[SALES LYTD],"POP",[SALES YOY])
summarize('Table',"Measure","unit","This period",[unit YTD],"Last period",[unit LYTD],"POP",[unit YOY])
)

 

or

 

union(
summarize('Table','Table'[country],"Revenue","sales","This period",[Revenue YTD],"Last period",[Revenue LYTD],"POP",[Revenue YOY])
summarize('Table','Table'[country],"Costs","unit","This period",[Costs YTD],"Last period",[Costs LYTD],"POP",[Costs YOY])
)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak , 

thanks a lot for your reply. I just tried both ways, however unfortunately both dont seem to work in my case.

For the first one I get the following error message: "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." and for the second one I get: "The column 'Country' specified in the 'SUMMARIZE' function was not found in the input table." Guess this is because my measures are stored in a different table than my country names. If so is there a workaround?

Hi  @NKAnalyst ,

 

Can you share your .pbix file for test?

Remember to remove the confidential information.

 

Best Regards,
Kelly

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

Hi @v-kelly-msft , unfortunately not since it contains confidential data (thats why I created excel tables with random data). any other idea for degubbig ?

Best regards

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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.