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

Conditional columns

Hi,

 

I have a table with monthly company data for 3 years. I am trying to reshape my table and make new columns for some of the metrics using conditional columns. My table looks like below:

 

CompanyMonthYearMetric nameMetric value
AJan2020Revenue100
AJan2020Cost50
AFeb2020Revenue110
AFeb2020Cost70
AFeb2020Tax10
BJan2020Revenue500
BJan2020Cost200
BJan2020Tax20

 

When I make the conditional columns, I still have seperate rows for each month and each metric and it looks like this:

 

CompanyMonthYearRevenueCost
AJan2020100 
AJan2020 50
AFeb2020110 
AFeb2020 70
BJan2020500 
BJan2020 200

 

But I want it to looks like this:

 

CompanyMonthYearRevenueCost
AJan202010050
AFeb202011070
BJan2020500200

 

Any suggestion is appreciated 🙂 .

 

 

 

8 REPLIES 8
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Inside the Power Query Editor, 

1. filter out the Tax rows

2. select Metric Name and Materic value columns

3. pivot those

4. Selecte Value column as Metric Value

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Anonymous
Not applicable

Hi,

@Jihwan_Kim Unfortunately the problem with date still exists. I did not get one row for january with Revenue and Cost values in the same row...

Anonymous
Not applicable

@Jihwan_Kim  I see the confusion. That is for another company (company B). So I'd like to have one row for each month per company 🙂 .

Hi,

Thank you for your feedback.

Please correct me if the link down below is not what you are looking for.

You can open it and go into Power Query, and you can check whether it is correctly done or not.

Thank you very much.

 

https://www.dropbox.com/s/9h1cobfb3i4te43/Fereshteh.pbix?dl=0 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Anonymous
Not applicable

Hi,

Thank you for your help, unfortunately I could not make it work with your proposed solution. I removed my Revenue and Cost columns and kept the year, company and the Year-to date column that I calculated from Revenue. It looks fine now.

Hi, @Anonymous 

Thank you for your feedback.

In your sample case, I see that your desired outcome also showed two rows for Jan.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

amitchandak
Super User
Super User

@Anonymous , first table when you create columns, Second table is when you create a measure.

Even if you create column, when you show on visual, it will group like second table

 

new columns 

revenue= if([Metric name] ="Revenue",[Metric Value], blank())

 

Cost= if([Metric name] ="Cost",[Metric Value], blank())

 

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
Anonymous
Not applicable

Hi,

Sorry, I am new to Power BI, do you mean that I should make a "custom column"? In that case, I get an error related to the [metric value].

 

Thanks.

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.