Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
I current have a column called Program. The values are separate by a semicoln and hashtag. The first table below is a mock up of the data and the 2nd table is my desired result. In the actual data there are 11 unqiue Programs that I will need to cater for.
Mocked up data
Program | Count |
Medical | 43 |
New Support | 59 |
All NRL;#Other | 77 |
Other | 94 |
Older Country;#Home and Parents;#Medical;#Work Services | 28 |
Payment Integrity | 89 |
Other | 37 |
Young and Learners;#Work Services:#Payment Integrity | 82 |
Desired Outcome
Progam Unqiue | Count |
All NRL | 77 |
Home and Parents | 28 |
Medical | 71 |
New Support | 59 |
Older Country | 28 |
Other | 208 |
Payment Integrity | 171 |
Work Services | 110 |
Young and Learners | 82 |
Solved! Go to Solution.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new table.
Desired table =
VAR _newtable =
ADDCOLUMNS ( Data, "@new", SUBSTITUTE ( Data[Program], ";#", "|" ) )
VAR _separate =
ADDCOLUMNS (
_newtable,
"@first", PATHITEM ( [@new], 1 ),
"@second", PATHITEM ( [@new], 2 ),
"@third", PATHITEM ( [@new], 3 ),
"@fourth", PATHITEM ( [@new], 4 )
)
VAR _finaltable =
UNION (
SUMMARIZE ( _separate, [@first], Data[Count] ),
SUMMARIZE ( _separate, [@second], Data[Count] ),
SUMMARIZE ( _separate, [@third], Data[Count] ),
SUMMARIZE ( _separate, [@fourth], Data[Count] )
)
RETURN
GROUPBY (
FILTER (
SELECTCOLUMNS (
_finaltable,
"@Program unique", [@first],
"@Count", Data[Count]
),
[@Program unique] <> BLANK ()
),
[@Program unique],
"Count", SUMX ( CURRENTGROUP (), [@Count] )
)
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.
Thank you for you assistance, it is very much appreciated.
Hi,
Please check the below picture and the attached pbix file.
It is for creating a new table.
Desired table =
VAR _newtable =
ADDCOLUMNS ( Data, "@new", SUBSTITUTE ( Data[Program], ";#", "|" ) )
VAR _separate =
ADDCOLUMNS (
_newtable,
"@first", PATHITEM ( [@new], 1 ),
"@second", PATHITEM ( [@new], 2 ),
"@third", PATHITEM ( [@new], 3 ),
"@fourth", PATHITEM ( [@new], 4 )
)
VAR _finaltable =
UNION (
SUMMARIZE ( _separate, [@first], Data[Count] ),
SUMMARIZE ( _separate, [@second], Data[Count] ),
SUMMARIZE ( _separate, [@third], Data[Count] ),
SUMMARIZE ( _separate, [@fourth], Data[Count] )
)
RETURN
GROUPBY (
FILTER (
SELECTCOLUMNS (
_finaltable,
"@Program unique", [@first],
"@Count", Data[Count]
),
[@Program unique] <> BLANK ()
),
[@Program unique],
"Count", SUMX ( CURRENTGROUP (), [@Count] )
)
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.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
92 | |
87 | |
84 | |
66 | |
49 |
User | Count |
---|---|
140 | |
114 | |
110 | |
59 | |
59 |