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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
yogeshmaney
Helper I
Helper I

Calculate for Comma Separated Values

Hello

 

Have Data as

Unit      |  Category 

5           |  Cat1,Cat2

3           |  Cat2

 

Want Result as

Cat1  = 5

Cat2  = 8

 

 

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee

Check this Power Query demo, it would help re-model your source from

 

Capture.PNG

 

To

 

Capture.PNG

 

let
    Source = Table.FromRows({{5,"Cat1,Cat2,Cat3"},{2,"Cat2"},{3,"Cat1,Cat2,Cat3"}},{"Unit","Category"}),
    Splitedsrc=Table.AddColumn(Source ,"splitCategory",each Table.FromList(Text.Split([Category],","))),
    ExpandedSplitCatesrc=Table.ExpandTableColumn(SplitedSrc, "splitCategory", {"Column1"}, {"splitCategory"})
in
    ExpandedSplitCateSrc

Then I think it is not a problem doing the calculation in your post. 

View solution in original post

1 REPLY 1
Eric_Zhang
Employee
Employee

Check this Power Query demo, it would help re-model your source from

 

Capture.PNG

 

To

 

Capture.PNG

 

let
    Source = Table.FromRows({{5,"Cat1,Cat2,Cat3"},{2,"Cat2"},{3,"Cat1,Cat2,Cat3"}},{"Unit","Category"}),
    Splitedsrc=Table.AddColumn(Source ,"splitCategory",each Table.FromList(Text.Split([Category],","))),
    ExpandedSplitCatesrc=Table.ExpandTableColumn(SplitedSrc, "splitCategory", {"Column1"}, {"splitCategory"})
in
    ExpandedSplitCateSrc

Then I think it is not a problem doing the calculation in your post. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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