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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
gluizqueiroz
Resolver I
Resolver I

How to separate each quarter in 3 lines with month and divide a specific number

I have the following table:

 

GroupQtyQuarterRegion
Eletronics4201°/2018North
Food6001°/2018North
Cloths4801°/2018North
Eletronics3002°/2018North
Food3602°/2018North
Cloths4502°/2018North

 

I need to divide each quarter in 3 lines with month and divide the column Qty by 3 for each month, like the following:

 

GroupQtyQuarterRegion
Eletronics140jan/2018North
Eletronics140feb/2018North
Eletronics140mar/2018North
Food200jan/2018North
Food200feb/2018North
Food200mar/2018North
Cloths160jan/2018North
Cloths160feb/2018North
Cloths160mar/2018North
Eletronics100apr/2018North
Eletronics100may/2018North
Eletronics100jun/2018North
Food120apr/2018North
Food120may/2018North
Food120jun/2018North
Cloths150apr/2018North
Cloths150may/2018North
Cloths150jun/2018North


Is there any way to achieve this with Power Query? 

1 ACCEPTED SOLUTION
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @gluizqueiroz 

Please paste below formula in advanced editor to check the workaround.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs1JLSnKz8tMLlbSUTIxMgCShoc26BsZGFoAmX75RSUZSrE60Upu+fkpQAEzA5wqnHPySzLApljgVINimzHYLCM8thmb4VSBsM0Uu5pYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Group = _t, Qty = _t, Quarter = _t, Region = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}, {"Qty", Int64.Type}, {"Quarter", type text}, {"Region", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Quarter_New", each if [Quarter] = "1°/2018" then "jan/2018,feb/2018,mar/2018" else if [Quarter] = "2°/2018" then "apr/2018,may/2018,jun/2018" else null),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Quarter"}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Quarter_New", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Quarter_New.1", "Quarter_New.2", "Quarter_New.3"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Split Column by Delimiter", {"Group", "Qty", "Region"}, "Attribute", "Value"),
    #"Removed Columns1" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
    #"Divided Column" = Table.TransformColumns(#"Removed Columns1", {{"Qty", each _ / 3, type number}})
in
    #"Divided Column"

Regards,

Community Support Team _ Cherie Chen
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

1 REPLY 1
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @gluizqueiroz 

Please paste below formula in advanced editor to check the workaround.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs1JLSnKz8tMLlbSUTIxMgCShoc26BsZGFoAmX75RSUZSrE60Upu+fkpQAEzA5wqnHPySzLApljgVINimzHYLCM8thmb4VSBsM0Uu5pYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Group = _t, Qty = _t, Quarter = _t, Region = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}, {"Qty", Int64.Type}, {"Quarter", type text}, {"Region", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Quarter_New", each if [Quarter] = "1°/2018" then "jan/2018,feb/2018,mar/2018" else if [Quarter] = "2°/2018" then "apr/2018,may/2018,jun/2018" else null),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Quarter"}),
    #"Split Column by Delimiter" = Table.SplitColumn(#"Removed Columns", "Quarter_New", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Quarter_New.1", "Quarter_New.2", "Quarter_New.3"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Split Column by Delimiter", {"Group", "Qty", "Region"}, "Attribute", "Value"),
    #"Removed Columns1" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"}),
    #"Divided Column" = Table.TransformColumns(#"Removed Columns1", {{"Qty", each _ / 3, type number}})
in
    #"Divided Column"

Regards,

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

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors