March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
133 | |
91 | |
88 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
73 | |
68 |