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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Remco1986
Helper I
Helper I

"comments" measure with selected values and respective result

Data contains Language column and Metric column. We have the languages:

- English

- French

- Dutch

- Greek

 

Using a switch formula, I have added a column called 'Tier' where English and French is Tier 1, and Dutch and Greek is Tier 2.

 

Now I want to produce a table with just the tier as rows, and a 'comment' field that shows me the languages under that tier, as well as the respective value of the metric.

 

the metric is 'Satisfaction' and is an average of the 'Satisfied' column which contains just a 1 or 0.

 

Expected output:

TierComment
Tier 1English: 85.1% | French: 89.9%
Tier 2

Dutch: 91.3% | Greek: 65.0%

 

I already managed to get the Languages listed in the comment field, using:

 

 

 

 

Comment = IF(ISFILTERED(data[Tier]),CONCATENATEX(VALUES(data[Language]),data[Language]&": (xxx)"," | ","All")

 

 

 

 

 

right now I'm struggeling to get the metric result in place of the xxx

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Remco1986 ,

According to your description, here's my solution.

1.Create a calculated column in data table, get the average satisfied value for each language.

Average =
FORMAT (
    CALCULATE (
        AVERAGE ( data[Satisfied] ),
        FILTER ( 'data', data[Language] = EARLIER ( data[Language] ) )
    ),
    "0.0%"
)

vkalyjmsft_0-1639724975175.png

2.Create a new table.

Table = SUMMARIZE('data','data'[Tier],'data'[Language],'data'[Average])

vkalyjmsft_1-1639725099507.png

 

3.Create the comment measure in the new table.

Comment = CONCATENATEX('Table','Table'[Language]&":("&'Table'[Average]&")","|")

Get the expected result.

vkalyjmsft_2-1639725182353.png

I attach my sample below to help you understanding.

 

Best Regards,
Community Support Team _ kalyj

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
v-yanjiang-msft
Community Support
Community Support

Hi @Remco1986 ,

According to your description, here's my solution.

1.Create a calculated column in data table, get the average satisfied value for each language.

Average =
FORMAT (
    CALCULATE (
        AVERAGE ( data[Satisfied] ),
        FILTER ( 'data', data[Language] = EARLIER ( data[Language] ) )
    ),
    "0.0%"
)

vkalyjmsft_0-1639724975175.png

2.Create a new table.

Table = SUMMARIZE('data','data'[Tier],'data'[Language],'data'[Average])

vkalyjmsft_1-1639725099507.png

 

3.Create the comment measure in the new table.

Comment = CONCATENATEX('Table','Table'[Language]&":("&'Table'[Average]&")","|")

Get the expected result.

vkalyjmsft_2-1639725182353.png

I attach my sample below to help you understanding.

 

Best Regards,
Community Support Team _ kalyj

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi there, thanks for your reply. After following all steps, I managed to get the desired result. However, the produced overview was not affected by any slicers anymore (probably because the newly generated table is not linked to them).

 

However, using your approach, I managed to implement it in the excisting datasource. Turned out that inside the 'comment' measure, I had to summarize the table. 

 

I also changed the percentage to be returned to a calculation of the 'satisfied' and the 'count'. Lastly, I had to implement a new dimension for 'Contact Type'.

 

All with all, you post surely helped me to achieve what I wanted, so I will mark it as a solution. 

 

For good measure, here's the 'comment' measure that I have now, and that is working the way I want. No extra columns, no extra tables, just this measure in my excisting table:

 

Comment = IF(ISBLANK(SELECTEDVALUE(data[Tier])),BLANK(),CONCATENATEX(SUMMARIZE('data','data'[Contact Type],'data'[Tier],'data'[Language]),'data'[Language]&": "&FORMAT([(%) Satisfied],"0.0%")," | "))

(note: the 'ISBLANK' part at the beginning is to make sure the 'comment' does not appear at the total or subtotal row, and I'm also returning the measure '(%) Satisfied' in the comment because that measure already excisted and is doing a ' SUM([Satisfied] / COUNT[Satisfied] ' calculation)

Hi @Remco1986 ,

Yes, it works fine with the SUMMARIZE function in the original formula, we are helping each other!

Best Regards,
Community Support Team _ kalyj

Remco1986
Helper I
Helper I

I now did this:

 

Comment = IF(ISFILTERED(data[Tier]),CONCATENATEX(VALUES(data[Language]),data[Language]&": ("&FORMAT(CALCULATE(AVERAGE(data[Satisfied]),data[Language]=data[Language]),"0.0%")&")"," | ","All")

 

But this results in the languages having the same score as the tier. I somehow need to filter the result to be filtered on the language that the concatenatex is currently returning

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors