Forum Discussion
Restricting Values for Total
- 7 years ago
Hi adaocabelo,
Here I made an sample as your description. I created two measures to meet your requirement.
CA1L = MAX(opaRametro[Value])/CALCULATE(COUNT(opaRametro[Product]))
Measure = SUMX(opaRametro,[CA1L])
Then we can get the result as we excepted.
For more details, please check the pbix as attached.
https://www.dropbox.com/s/eakbjcoo32a90l6/Restricting%20Values%20for%20Total.pbix?dl=0
Regards,
Frank
Sorry, but, how do I use that?
Think my filter is a bit harder to apply then the one on the example.
On the example the filter was "amount >1000", I need to filter only one result for each product and sum that.
All Selected function is not working for this purpose.
How should I refer on the filter to have these results?
The example is just that, an example. Each formula is going to be different. For example, your total line might be something like:
= ... DIVIDE(SUMX(ALLSELECTED(Table),[Value]),COUNTX(ALLSELECTED(Table),[Value]))
Or, now that I am looking at this a little closer, couldn't you just use a standard Average aggregation? Or is Value a measure?
- adaocabelo7 years agoFrequent Visitor
Hi Greg,
thanks for your patience.
The total I need is not an average, because I need to sum only one value per product and the average produces a diferent result.
I've tried to make an paramater to index the lines, my idea was to sum only the rows with index = 0, but I've notice that Power BI has created the same number of lines for each index. For an example, if product 1 has 32 lines, power BI creates 32 index 0, 32 index 1...
Just to try to be more clear, from my first example: $5300,00(sum of all rows), $481,81(average) and R$1600,00(sum of one value, or price, per product).
- v-frfei-msft7 years agoCommunity Support
Hi adaocabelo,
Here I made an sample as your description. I created two measures to meet your requirement.
CA1L = MAX(opaRametro[Value])/CALCULATE(COUNT(opaRametro[Product]))
Measure = SUMX(opaRametro,[CA1L])
Then we can get the result as we excepted.
For more details, please check the pbix as attached.
https://www.dropbox.com/s/eakbjcoo32a90l6/Restricting%20Values%20for%20Total.pbix?dl=0
Regards,
Frank
- adaocabelo7 years agoFrequent Visitor
Thanks Frank,
this solution really works for my example, I could replicate that here.