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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
TheJ010
New Member

Help on summing and grouping with slicers

Hi all,

So my dateset looks like this.

Date_keyYear_weekSearch_PhraseSearchesCustomer TypeChannelCTRProduct Group
20230101202310powerbi28RetailWeb10%software
20230101202310powerbi10BusinessWeb2%software

 

I want to create a dashboard with

Search PhraseSearchesCTR
powerbi387,8% (= weighted average)

 

On the left I have slicers with 
1. Date_key
2. Year_week
3. Channel
4. Product Group

5. Customer Type

 

First question

- I need the searches amounts to be adjusted to the selections in the slicers

- AND identical searches phrases need to be summed so in this case 10 + 28

Second question
- I need the CTR to be weighted average of the CTRs

What variables do I need to add in my model to get this desired result?

Thanks for your help!

 

1 ACCEPTED SOLUTION
visheshjain
Impactful Individual
Impactful Individual

Hi @TheJ010,

 

You do not need mention SUM() function twice in your measure.

 

Define the total of the searches as Sum of Phrase Searches =  SUM(Table, Phrase Searches) and then use this measure as the denominator in the SUMX() function.

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



View solution in original post

5 REPLIES 5
Udbz
Regular Visitor

So

 if I understand this correctly, you basically want a groupby behavior in tour dashboard and slicers to affect your report.

That should be the defut behavior when u drag and and drop your search term to a table and views in the values bucket.

 

when it comes to the getting weighted average, you must define wht are the weights based of?

  • Say if ur basically weighing on basis of searches and ctr then u may use this
  • SUMX(thistable, thistable[searches]*thistable[ctr])/Sum(Sum( searches)
  • do note to divide by the sum of searches outside the SUMX .

 Basically for every row occuring aginst the search term ' a' you're multiplying searches and ctr, then after the multiplying is done ur dividing it by the total sum of searches.

 

If you find my answer helpful, an up vote would be appreciated 😊

 

This unfortunately did not work.

SUMX(TABLE, TABLE[SEARCHES]*TABLE[Clickrate])/SUM(SUM(AF_SEARCH_DB[SEARCHES]))

visheshjain
Impactful Individual
Impactful Individual

Hi @TheJ010,

 

Make 2 measures:

1. Sum of Phrase Searches =  SUM(Table, Phrase Searches)
2. Weighted Average = SUMX(Table, (Phrase Search* CTR)/[Sum of Phrase Searches]) i.e Use the first measure in the 2nd one.

Apologies, if my syntax is wrong, but you get the gist.

 

Create the drop everything on the table visual and slicers as you need and PBI will take care of the rest.

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Too many arguments were passed to the SUM function. The maximum argument count for the function is 1.

I get this error argument.

visheshjain
Impactful Individual
Impactful Individual

Hi @TheJ010,

 

You do not need mention SUM() function twice in your measure.

 

Define the total of the searches as Sum of Phrase Searches =  SUM(Table, Phrase Searches) and then use this measure as the denominator in the SUMX() function.

Did I answer your question?
If yes, then please mark my post as a solution!

Thank you,
Vishesh Jain

Proud to be a Super User!



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.