cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TCR_Carlsberg Frequent Visitor
Frequent Visitor

How to make mesaure work on multiple lines or have columns react to filters?

Hi you more experienced Power BI users

 

I can't get a measure to calculate my values correct so if someone could explain what I am doing wrong that would be much appriciated. I have created a very simple testcase - don't look like I can attache that file to this message thou... I'll try to display what I have in the text and pictures.

I have 5 tables. 

image.png

Product, Customers and Campaigns
Then two relational tables connecting the Campaigns with Customers and Products.

 

In the Campaign table I have a measure that calculate the max score that is Customers x Products. This measure works fine on a row level but as you can see above it fails when looking at more than one campaign at a time.

MeasureTotScore = Campaigns[CountCustomers]*Campaigns[CountProduct]
CountCustomers = COUNTROWS('RelationCampCust')
CountProduct = COUNTROWS('RelationCampProd')

If I instead create a Column with the same formula it works fine for one or more Campaigns but then the values dont react to Filter changes. Again looking at the picture - if I select Product type A I want that to reflect in my numbers. This is what I get:

image.png

Again on a single row the measure does it job but completely fails when looking on multiple lines. And the calculated column isnt affected at al of my selection. The result I want is 12 in my example above.

 

Any pointers for a newbi?

 

Regards,

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-yulgu-msft
Microsoft

Re: How to make mesaure work on multiple lines or have columns react to filters?

Hi @TCR_Carlsberg,

 

In my test, I named the three tables as 'Products', 'Customers' and 'Campaigns'. Please try below measures:

CountCustomers = DISTINCTCOUNT(Campaigns[CustID])
CountProduct = DISTINCTCOUNT(Campaigns[ProdID])

MeasureTotScore = SUMX(Campaigns, Campaigns[CountCustomers]*Campaigns[CountProduct])

1.PNG2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

1 REPLY 1
Microsoft v-yulgu-msft
Microsoft

Re: How to make mesaure work on multiple lines or have columns react to filters?

Hi @TCR_Carlsberg,

 

In my test, I named the three tables as 'Products', 'Customers' and 'Campaigns'. Please try below measures:

CountCustomers = DISTINCTCOUNT(Campaigns[CustID])
CountProduct = DISTINCTCOUNT(Campaigns[ProdID])

MeasureTotScore = SUMX(Campaigns, Campaigns[CountCustomers]*Campaigns[CountProduct])

1.PNG2.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors