Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Chavas
Helper II
Helper II

Get average based on another table values

Hello, I am facing a problem that it should be really easy and there should be a lot of information but I have not found it so something I should be doing wrong.

I have a model with 3 tables
1 per department

SubdepartmentPopulationSubmited
Sellers53
Administration32

1 per persons

IDDepartmentSubdepartment
1SalesSellers
2AdministrationAccountability

1 per answers of a survey (AKA NPSData)

 
IDCategoryQuestionAnswerNPS Value
26Work environmentq12Detractor
42Work environmentq12Detractor
49Work environmentq22Detractor
64Work environmentq12Detractor
28Work environmentq24Detractor

 

Department is related with persons and persons are related with NPSData

 

Then I am creating a visual to show the NPS per question and I would like to know the % of promoters or Detractors based on the department population (As far as not every person on the department has fulfilled the survey) so I can create an slicer to navigate through the subdepartments to get the % of Promoters/Neutrals/detractors by question by department.

 

So at the end, within a visual like this barchar

 

Left- Graph visual Right- TableLeft- Graph visual Right- Table

 

On the right side is a table, and I will only need to add a measure which divides each of this column, but I am stucked o nhow to do it.

I have tried something like:

DIVIDE(
    COUNTA('NPSDATA'[NPS Value]),
    VALUES('Department'[DptPopulation])
)
 
But it does not work. Could you please help me? Thanks in advance
1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi, @Chavas 

You need to modify your second measure slightly.If you want to change  multiply this value by 100 to show it in % ,it is recommended that you do not use the Text "nan" in the third parameter of function "Divide".You cannot mix different types of data in one column if you want to  show it in %.

 

 

measure =
DIVIDE (
    COUNTA ( NPSDATA[Category] ),
    SELECTEDVALUE ( Department[DptPopulation] )
)

 

42.png

In addition ,please check whether the field "Subdepartment" in you left graph visual are the same as the field "Subdepartment"  in right Table viusal  

 

Best Regards,
Community Support Team _ Eason

View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Chavas 

You need to modify your second measure slightly.If you want to change  multiply this value by 100 to show it in % ,it is recommended that you do not use the Text "nan" in the third parameter of function "Divide".You cannot mix different types of data in one column if you want to  show it in %.

 

 

measure =
DIVIDE (
    COUNTA ( NPSDATA[Category] ),
    SELECTEDVALUE ( Department[DptPopulation] )
)

 

42.png

In addition ,please check whether the field "Subdepartment" in you left graph visual are the same as the field "Subdepartment"  in right Table viusal  

 

Best Regards,
Community Support Team _ Eason

Chavas
Helper II
Helper II

Okay I achieved to do it in the table
DAX:

(DIVIDE(counta(NPSDATA[Category]),SELECTEDVALUE(Department[DptPopulation]),"nan"))

But I cannot use it on the graph side, it si not displaying anything.
Also I cannot multiply this value by 100 to show it in %

I am missing somthing?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.