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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Power Query -How to add additional rows, based on requirements, to a specifically structured dataset

Hi,
Below I have added a screenshot of the dataset I have. I have two requirements that I need to implement on top of this dataset. I do not believe this is doable in DAX so I am requesting this be complete using Power Query.

 

Requirement 1:
For each Division and Category, like a Group By, I require a new row creating with the text of 'SSGP' added as the Grouping_Level value, and the value field containing the sum (Sales - Costs). For example,

Division       Grouping_Level       Category       Value
South East   SSGP                       DEValue         (whatever the (Grouping_Level.Sales - Grouping_Level.Costs) calculation returns)
South East   SSGP                       DETarget        (whatever the (Grouping_Level.Sales - Grouping_Level.Costs) calculation returns)
South East   SSGP                       MTDValue      (whatever the (Grouping_Level.Sales - Grouping_Level.Costs) calculation returns)
South East   SSGP                       MTDTarget    (whatever the (Grouping_Level.Sales - Grouping_Level.Costs) calculation returns)

I require these additional rows added for each Division and Category. There are many Divisions but only the same four Category values for each Division and Grouping_Level.

Requirement 2:

For each Division and Category, again like a Group By, I require a new row creating with the text of 'Gross Profit' added as the Grouping_Level value, and the value field containing the sum (SSGP + FCP + CoS Adj + Customer Rebate + Settlement + Supplier Rebate). For example:
Dvision         Grouping_Level       Category     Value
South West  Gross Profit             DEValue       [SSGP] + [FCP] + [CoS Adj] + [Customer Rebate] + [Settlement] + [Supplier Rebate]
South West  Gross Profit             DETarget      [SSGP] + [FCP] + [CoS Adj] + [Customer Rebate] + [Settlement] + [Supplier Rebate]
South West  Gross Profit             MTDValue    [SSGP] + [FCP] + [CoS Adj] + [Customer Rebate] + [Settlement] + [Supplier Rebate]
South West  Gross Profit             MTDTarget  [SSGP] + [FCP] + [CoS Adj] + [Customer Rebate] + [Settlement] + [Supplier Rebate]

 

I require these additional rows added for each Division and Category. Again, there are many Divisions but only the same four Category values for each Division and Grouping_Level.

Please can someone help me achieve this?
Any help will much appreciated. Thanks in advance.


Dataset.PNG

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

 

If it is convenient, could you share your data sample as table format and your desired output so that I can copy your data and test on it.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.