Forum Discussion
Filtering calculated measure to remove one category
Hi all
I've got a fairly complex scenario that I'm trying to get my head around. I've thought about using a couple of measures to resolve, but they aren't working in the way I expect, so hoping someone can help me either fix the measures, or suggest a better way of dealing with the scenario.
I'm using Salesforce data, and reporting on the value of quotes issued to customers. We have several locations, and I have a locations table linked to my quotes table so that Location can be used as a slicer in visualisations. There are a handful of quotes that involve work by more than one location, and these have the Location set to "Multi". The business would like to be able to attribute a portion of the "Multi" value to each relevant location and roll these up into a measure with the value originally attributed to each location, but still retain the ability to report on "Multi" and non-rolled up values.
My plan is to have the portion assigned to each location stored in a field on the quotes record, then hold these values in a seperate table in Power BI, linked to the original quotes record. I've figured out how to unpivot the tables and store the values so that they look like:
| Quote ID | Multisite Location | Value |
| AA123 | Location1 | 100 |
| AA123 | Location2 | 100 |
| BB124 | Location1 | 200 |
I currently have a measure to work out quote value, that picks up the relationship to my exchange rates table and my calendar table (because I have multiple dates on my quote table):
Value of quotes (000s) =
var ExchangeRate = MAX('Exchange Rates'[Conversion Rate])
return
CALCULATE(DIVIDE(SUM(Quote[Value]),1000,0)/ExchangeRate,
USERELATIONSHIP(Quote[QuoteIssuedDate],'Calendar'[Date]))
My plan was to make a copy of this measure, adding a filter to remove the quotes with location of "Multi", make a measure for my multisite locations table and then a third measure adding the two measures together. But my filtered measure isn't returning the right values for the other locations. This is what I've come up with:
Value of Complete Site Specific Quotes (000s) =
var ExchangeRate = MAX('Exchange Rates'[Conversion Rate])
return
CALCULATE(DIVIDE(SUM(Quote[Value]),1000,0)/ExchangeRate,
FILTER(Quote,Quote[Location] <> "Multi"),
USERELATIONSHIP(Quote[QuoteIssuedDate],'Calendar'[Date]))
Can anyone tell me what I've done wrong? Or am I going down the complete wrong path for this scenario? Any advice greatly appreciated!
Many thanks
df
- Anonymous4 years ago
Hi all
After a day of deliberations, I've decided the best way forward is to have 2 seperate tables of data for each reporting scenario, and have the measures referencing the relevant tables each time. I need to think a bit more about the relationships between the tables, but happy that what I was trying to do with measures is not the way they're designed to work.
1 Reply
- AnonymousNot applicable
Hi all
After a day of deliberations, I've decided the best way forward is to have 2 seperate tables of data for each reporting scenario, and have the measures referencing the relevant tables each time. I need to think a bit more about the relationships between the tables, but happy that what I was trying to do with measures is not the way they're designed to work.