The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
119 | |
86 | |
75 | |
55 | |
44 |
User | Count |
---|---|
135 | |
125 | |
78 | |
64 | |
63 |