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
Anonymous
Not applicable

Need Help on Count using related tables

Hi All,

 

I have the following tables.

 

dimScale, dimOption and dimQuestion

 

OptionScaleConcat|QuestionOptionQuestionQuestionGroup
Strongly Disagree11-Strongly DisagreeQ1Strongly DisagreeQ1Group 1
Disagree22-DisagreeQ1DisagreeQ2Group 2
Neutral33-NeutralQ1NeutralQ3Group 2
Agree44-AgreeQ1AgreeQ4Group 2
Strongly Agree55-Strongly AgreeQ1Strongly AgreeQ5Group 3
ExtremelyDissatisfied11-ExtremelyDissatisfiedQ2ExtremelyDissatisfiedQ6Group 4
Dissatisfied22-DissatisfiedQ2DissatisfiedQ7Group 5
Satisfied44-SatisfiedQ2NeutralQ8Group 6
ExtremelySatisfied55-ExtremelySatisfiedQ2SatisfiedQ9Group 6
Significantly Inferior11-Significantly InferiorQ2ExtremelySatisfiedQ10Group 7
Inferior22-InferiorQ3ExtremelyDissatisfied  
Same33-SameQ3Dissatisfied  
Superior44-SuperiorQ3Neutral  
Significantly Superior55-Significantly SuperiorQ3Satisfied  
Not at all effective11-Not at all effectiveQ3ExtremelySatisfied  
Not very effective22-Not very effective|     
Effective44-Effective     
Extremely effective55-Extremely effective     

 

and factData

 

CountrySurveyTypeDateQuestionScale
Country 1Type 11/1/2017Q12
Country 1Type 11/1/2017Q14
Country 1Type 11/1/2017Q15
Country 1Type 11/1/2017Q14
Country 1Type 11/1/2017Q13
Country 1Type 11/1/2017Q23
Country 1Type 11/1/2017Q24
Country 1Type 11/1/2017Q25
Country 1Type 11/1/2017Q24
Country 1Type 11/1/2017Q24
Country 1Type 11/1/2017Q34
Country 1Type 11/1/2017Q34
Country 1Type 11/1/2017Q35
Country 1Type 11/1/2017Q34
Country 1Type 11/1/2017Q34

 

Now I want the results in the following format (for Group 2)

 

ResponseCount
1-ExtremelyDissatisfied0
2-Dissatisfied0
4-Satisfied7
5-ExtremelySatisfied2

 

 

I have joins like

 

first 2 tables joined on 'Option'

 

2nd and 3rd on 'Question'

 

and again on 'Question' with 3rd and data table.

 

I hope this make sense. Any help would be appreciated.

 

Sorry for the not so good layout.

 

Kris

1 ACCEPTED SOLUTION
Phil_Seamark
Employee
Employee

HI @Anonymous

 

One approach is to flatten your dimOption, dimScore and factData into 1 table and only join that to dimQuestion

 

I have created a sample PBIX file here using your data

 

https://1drv.ms/u/s!AtDlC2rep7a-oCFNYLAo0g761ph7

 

This includes the steps I have taken in the Query Editor to combine the three tables.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Employee
Employee

HI @Anonymous

 

One approach is to flatten your dimOption, dimScore and factData into 1 table and only join that to dimQuestion

 

I have created a sample PBIX file here using your data

 

https://1drv.ms/u/s!AtDlC2rep7a-oCFNYLAo0g761ph7

 

This includes the steps I have taken in the Query Editor to combine the three tables.


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Anonymous
Not applicable

Thanks Phil. Works fine.

 

Appreciate your help.

 

Kris

Anonymous
Not applicable

Bump*

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.