Forum Discussion
hi
Hello,
Here I have a few sample data.
| C_ID | C_PHONE | B_POINT |
| 16015 | 161622020 | 151.2176 |
| 60154 | 161622020 | 744.0992 |
| 60021 | 131619522 | 61.9386 |
| 60121 | 131619522 | 3452.1312 |
| 92432 | 132281355 | 50.1 |
| 92502 | 132281355 | 0 |
| 90174 | 132281355 | 619.3274 |
| 60156 | 140400500 | 664.8464 |
| 16015 | 140400500 | 0 |
| 13003 | 140400500 | 0 |
C_ID--- Customer ID is unique
C_PHONE--- Customer Phones are sometimes duplicates or more than even two time
B_POINT--- got Point balance is according to customer ID and Customer Phone number
What I need is using above table,
1) I want to keep the Customer's Phone number which has the highest Balance Point (Remove Duplicate mobile number as per the highest Balance Point)
Expected Outcome for Highest using abovetable,
| C_ID | C_PHONE | B_POINT |
| 60154 | 161622020 | 744.0992 |
| 60121 | 131619522 | 3452.131 |
| 90174 | 132281355 | 619.3274 |
| 60156 | 140400500 | 664.8464 |
2) I want to keep the Customer's Phone number which has the lowest Balance Point (Remove Duplicate mobile number as per lowest Balance Point)
Expected Outcome for Lowest using above table,
| C_ID | C_PHONE | B_POINT |
| 16015 | 161622020 | 151.2176 |
| 60021 | 131619522 | 61.9386 |
| 92502 | 132281355 | 0 |
| 16015 | 140400500 | 0 |
| 13003 | 140400500 | 0 |
Thanks
- Anonymous2 years ago
Hi abc_777
You can add an intermediate table to have highest and lowest balance point for each phone number first.
Table 2 = SUMMARIZE('Table','Table'[C_PHONE],"max_point",MAX('Table'[B_POINT]),"min_point",MIN('Table'[B_POINT]))Then create two measures as below. Add them to the table visuals filter pane separately and set the value to 1.
Max Filter = IF(SELECTEDVALUE('Table'[B_POINT])=MAX('Table 2'[max_point]),1,0)Min Filter = IF(SELECTEDVALUE('Table'[B_POINT])=MAX('Table 2'[min_point]),1,0)Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos! - Anonymous2 years ago
Hi abc_777
I realize that my previous solution is not very efficient with more data. Its performance is bad and may hit the data point limit in a visual. Please try a new solution with below measures. And you don't have to create the intermediate table.
MaxFilterSheet2 = var _maxPoint = CALCULATE(MAX(Sheet2[B_POINT]),ALLEXCEPT(Sheet2,Sheet2[C_PHONE])) return IF(SUM(Sheet2[B_POINT])=_maxPoint,1)MinFilterSheet2 = var _minPoint = CALCULATE(MIN(Sheet2[B_POINT]),ALLEXCEPT(Sheet2,Sheet2[C_PHONE])) return IF(SUM(Sheet2[B_POINT])=_minPoint,1)Please see the table visuals on Page 2 in the attached pbix.
In addition, there are some whitespaces in the sample data that causes errors when changing data types, so I remove these whitespaces with Power Query Editor. You can find the detailed steps in the pbix. Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!
8 Replies
- amitchandakSuper User
abc_777 , try these two measures
M1 = calculate(max(Table[B_POINT]), filter(allselected(Table), Table[C_ID] = max(Table[C_ID]) ))
M2 = calculate(Sum(Table[B_POINT]), keepfilter(topn(5,allselected(Table[C_ID]), [M1], desc))) + calculate(Sum(Table[B_POINT]), keepfilter(topn(5,allselected(Table[C_ID]), [M1], asc)))- abc_777Solution Specialist
Hello amitchandak ,
i have used both measure and here is my pbi file but haven't get expected out come. please check
here is pbi file link
https://drive.google.com/drive/folders/1KI-tPZTT9J9yXVIDsJRL284_Jg991654?usp=sharing
- abc_777Solution Specialist
i m not rude but requesting you please dont reply to any of my requested blogs post. thanks
- AnonymousNot applicable
Hi abc_777
You can add an intermediate table to have highest and lowest balance point for each phone number first.
Table 2 = SUMMARIZE('Table','Table'[C_PHONE],"max_point",MAX('Table'[B_POINT]),"min_point",MIN('Table'[B_POINT]))Then create two measures as below. Add them to the table visuals filter pane separately and set the value to 1.
Max Filter = IF(SELECTEDVALUE('Table'[B_POINT])=MAX('Table 2'[max_point]),1,0)Min Filter = IF(SELECTEDVALUE('Table'[B_POINT])=MAX('Table 2'[min_point]),1,0)Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!- abc_777Solution Specialist
perfect Anonymous , thx buddy for the solution. thank you so much
but when i tried with more data its not working for me. i have given an excel file link here. please help me with
https://drive.google.com/drive/folders/1_6SrAlvmKRDgTLdPWfbUshk9h_tVBl20?usp=drive_link
thx
- abc_777Solution Specialist
Anonymous
your one is perfect but cant make with more data. please requesting you help me out with the excel file link i have given
https://drive.google.com/drive/folders/1_6SrAlvmKRDgTLdPWfbUshk9h_tVBl20?usp=drive_link
thanks