Forum Discussion
Distinctcount filtered by measure
Hi,
I want to use the following expression:
I hope someone can help me with this problem. Thank you in advance!
nele Try:
Partners pos Data = VAR __Table = FILTER( ADDCOLUMNS( SUMMARIZE('Store Performance',[Customer Partner Name]), "__salesDelta",[salesDelta] ), [__salesDelta]>0 ) RETURN COUNTROWS( DISTINCT( SELECTCOLUMNS(__Table,"Customer Partner Name",[Customer Partner Name]) ) )
7 Replies
- Greg_Deckler
Community Champion
nele Try:
Partners pos Data = VAR __Table = FILTER( ADDCOLUMNS( ALLSELECTED('Store Performance), "__salesDelta",[salesDelta] ), [__salesDelta]>0 ) RETURN COUNTROWS( DISTINCT( SELECTCOLUMNS(__Table,"Customer Partner Name",[Customer Partner Name]) ) )- neleFrequent Visitor
Greg_Deckler , Thank you for your quick response! Unfortunately, it still gives me the same outcome.
- Greg_Deckler
Community Champion
nele What's the formula for salesDelta? Sample data would probably help as well. Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
- neleFrequent Visitor
Greg_Deckler , maybe I need to add that the [salesDelta] is calculated per "Customer Partner Name", but this is not based on 1 row. There are multiple rows for 1 partner and based on the sum of these rows, the [salesDelta] is calculted. I think this is the reason that I cannot just add a column "salesDelta" in my dataset, since the average of the individual salesDelta's is not the same as the salesDelta of the sum of the individual rows.