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
winwell
Frequent Visitor

Help on data structure - and visualising data in different columns

 

Main_Event Table:

idNameSO1SO2SO3SO4SO5Benefit1Benefit2Benefit3Benefit4Benefit5
1OneSO1 Strategic ObjectiveSO1 Strategic ObjectiveSO2 Strategic ObjectiveSO5 Strategic Objective Benefit Type 1Benefit Type 10Benefit Type 17Benefit Type 19 
2TwoSO2 Strategic ObjectiveSO2 Strategic ObjectiveSO2 Strategic ObjectiveSO5 Strategic ObjectiveSO5 Strategic ObjectiveBenefit Type 2Benefit Type 11Benefit Type 18Benefit Type 20Benefit Type 21
3ThreeSO1 Strategic ObjectiveSO1 Strategic Objective   Benefit Type 3Benefit Type 12   
4FourSO2 Strategic ObjectiveSO3Strategic Objective   Benefit Type 4Benefit Type 13   
5FiveSO3Strategic ObjectiveSO4 Strategic Objective   Benefit Type 5Benefit Type 14   
6SixSO4 Strategic ObjectiveSO4 Strategic Objective   Benefit Type 6Benefit Type 15   

 

Pre_event_scores table

idEventIDBenefit1Benefit2Benefit3Benefit4Benefit5
112345 
213435 
314454 
413335 
512543 
613334 
714223 
814532 
9253242
10233333
11232222
12244444
13233333
14322   
15334   
16333   
17323   
18441   
19424   
20432   
21443   
22524   
23533   
24524   
25513   
26644   

 

 

Posr_event_scores table

idEventIDBenefit1Benefit2Benefit3Benefit4Benefit5
115657 
216786 
317675 
416866 
515777 
616866 
717777 
816656 
9277656
10288765
11267666
12276767
13267678
14388   
15379   
16368   
17377   
18466   
19457   
20468   
21457   
22566   
23577   
24588   
25577   
26686   
27675   

 

 We run training events and each record in the Main_Events table is a different event. We use the id as an identifier. For each event we ask the client to identify which benefit they want to see improved. There are many benefits. Each benefit can be mapped to one of 5 high level Strategic Objectives (SO1, SO2, SO3, SO4, SO5). When the initial record is created we identify the SO for each benefit. Some benefits can map to the same SO. 

 

Before the event we run a candidate survey to get the scores for each benefit (i.e. how they rate themselves against each one). The results are caputed for each Benefit and we use the Main_event table id -> to the EventID in the Pre_event_scores so its a one to many relationship - we can identify which set of survey responses relate to which record on the Main_event table.

 

After the event we run another survey asking the same questions, capturing the same data in the same way. 

The difference between the scores is our uplift.

My Ask...

I am using Power BI desktop to create a dashboard showing benefits realised for each event, and ideally by Strategic Objective.I have tried googling the answer but get no real guidance, so I hope you can point me in the right direction.

 

I have these tables in Power BI and can easily slice the results by id - so show benefit results for a single event - we can do that.But ... I cannot figure out how to show results for a specific Strategic Objective as they can appear in different columns.

So if I wanted to show the overall uplift for say, Strategic Objective1, for say Events 1, 2 and 3 is that doable?

Is our data structured in a way to even make it possible?

So any help you can offer is appreciated even if it means restructuring the data as we are in the early stages of this,

Apologies for the vague title but I am struggling how to articulate the issue.

Many thanks

 

4 REPLIES 4
winwell
Frequent Visitor

if it helps, I can upload a pbix file with some sample data and visuals

winwell
Frequent Visitor

 SO I tried to delete the columns from a copy of the table and just unpivoted the relevnt cols leaving the id col. That worked so the data unpivoted fine. However, because the id column is my primary key column that is on the ONE side of the one to many relationship to the other two tables (Pre and Post) I dont appear to be able to get the values of the relevant Event ID from those two tables now. Is that because there are multiple instances of the id in the main table? 

amitchandak
Super User
Super User

@winwell , I think unpivot of columns can help 

 

Use in blank query in power query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("nZE9D8IgEIb/CmHuIF9VVwdXhnYjHbQ5FYfWEPz690LjILkgaROOXO6Fe+4FYyijFdUDhL3RjDTeHTycbU/08Qq9t4+SwrOKyigkxA4GOFlP2vcNCEOFFaqsUWU7teoqQ3nI2udYGGeJkrOQV5IZORoaW92gS8g8Z5NNEW1eHCz9K/ITSX+BhuLJ8QiXIduPd1d4MDETLRFaILSK6AKg0XKua4XQEqHr2Nq+/gIWoGuEVt9jcXXdBw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [id = _t, Name = _t, SO1 = _t, SO2 = _t, SO3 = _t, SO4 = _t, SO5 = _t, Benefit1 = _t, Benefit2 = _t, Benefit3 = _t, Benefit4 = _t, Benefit5 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"Name", type text}, {"SO1", type text}, {"SO2", type text}, {"SO3", type text}, {"SO4", type text}, {"SO5", type text}, {"Benefit1", type text}, {"Benefit2", type text}, {"Benefit3", type text}, {"Benefit4", type text}, {"Benefit5", type text}}),
    #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"id", "Name"}, "Attribute", "Value")
in
    #"Unpivoted Other Columns"

 

 

Unpivot Data(Power Query): https://youtu.be/2HjkBtxSM0g

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for pointing me in the right direction

I tried to unpivot the actual tables but receive this error when applying th echanges:

 

[My Actual Table name]
Column 'Id' in Table '[My Actual Table Name]' contains a duplicate value '2' and this is not allowed for columns on the one side of a many-to-one relationship or for columns that are used as the primary key of a table.
 
So the id column is causing me a problem as it's the unique col from the sharepoint list and it is this id value that has a one to many relationship with the other two tables containing the Pre and Post scores.
 
Is there a way to overcome this error please?
 
Thank you

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