Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
vkboddapati
Frequent Visitor

Top 3 customers list (Receipts and Payments) based on date range

Hellow Everyone,
Need help! I have data like below (sample data):
Date |         Doc No|      Trans Type|  Client Code| Bank Account | Debit |  Credit  | Balance 

01-Jan-2213920B. Payments6786151470                           -            1,622.42            -1,622.42
01-Jan-2213922B. Payments6732211470                           -               155.26                -155.26
01-Jan-2213924B. Payments6903011470                           -               493.42                -493.42
01-Jan-2213925B. Payments6922501470                           -            1,536.06            -1,536.06
03-Jan-2213897B. Payments6394072003                           -            1,180.00            -1,180.00
03-Jan-2213898B. Payments6002652003                           -               590.00                -590.00
03-Jan-2213937B. Payments6725651461                           -         38,613.00          -38,613.00
03-Jan-2213977B. Payments6906232003                           -      1,23,318.00      -1,23,318.00
05-Jan-2213968B. Payments6276781461                           -   43,52,622.00    -43,52,622.00
05-Jan-2213969B. Payments6876821461                           -         10,732.00          -10,732.00
05-Jan-2213974B. Payments6529382003                           -               590.00                -590.00
06-Jan-2214037B. Payments6684422003                           -            1,180.00            -1,180.00
07-Jan-2214093B. Payments6273941470                           -            2,748.33            -2,748.33
10-Jan-2214340B. Payments6868311461                           -   15,04,580.00    -15,04,580.00
10-Jan-2214342B. Payments6072671461                           -   30,26,759.00    -30,26,759.00
10-Jan-2214343B. Payments6717321461                           -   49,40,008.00    -49,40,008.00
10-Jan-2214344B. Payments6876961461                           -         47,076.00          -47,076.00
01-Jan-2213841B. Payments5172441461     14,43,159.00                       -       14,43,159.00
03-Jan-2213929B. Payments5542581470  4,60,00,000.00                       -    4,60,00,000.00
03-Jan-2214955B. Payments5360501481        1,75,680.54                       -          1,75,680.54
10-Jan-2214262B. Payments5042501461  1,20,00,000.00                       -    1,20,00,000.00
10-Jan-2214265B. Payments5287891461  1,50,00,000.00                       -    1,50,00,000.00
11-Jan-222739A. Receipts5444961468     14,70,431.56                       -       14,70,431.56
13-Jan-222888A. Receipts5651531453     88,99,590.00                       -       88,99,590.00
13-Jan-2214490B. Payments5214231461     50,00,000.00                       -       50,00,000.00
14-Jan-222629A. Receipts5641811453     31,17,306.00                       -       31,17,306.00
20-Jan-222650A. Receipts5228311481     65,39,226.12                       -       65,39,226.12
01-Jan-222553A. Receipts5227752003  3,16,58,175.00                       -    3,16,58,175.00

and I want the output as below:

vkboddapati_0-1647266658232.png

Please help me with relavant suggessions and functions, I have been trying with TopN but couldn't succeed.
Thanks in Advance,
VKB

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @vkboddapati,

You can do unpivot columns on the 'Debit, Credit, Balance' fields to convert them to attribute and vlaue.

Unpivot columns (Power Query) (microsoft.com)

Then you can create a new parameter table with all category types that you want to use and use them on matrix row fields, raw table bank account on column fields. 

After these steps, you can create a measure formula with switch function to check the current category and redirect to different calculation expressions:

My Favorite DAX Feature: SELECTEDVALUE with SWITCH | Winston-Salem Power BI User Group (pbiusergroup...

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @vkboddapati,

You can do unpivot columns on the 'Debit, Credit, Balance' fields to convert them to attribute and vlaue.

Unpivot columns (Power Query) (microsoft.com)

Then you can create a new parameter table with all category types that you want to use and use them on matrix row fields, raw table bank account on column fields. 

After these steps, you can create a measure formula with switch function to check the current category and redirect to different calculation expressions:

My Favorite DAX Feature: SELECTEDVALUE with SWITCH | Winston-Salem Power BI User Group (pbiusergroup...

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Many Thanks, @v-shex-msft!  
I got the desired result!

vkboddapati_1-1647539476536.png

However, got an additional requirement of "Opening" & "Closing" balances in the same matrix on which I'm working, below is the link of it:   
https://community.powerbi.com/t5/Desktop/Dynamic-Opening-and-Closing-Balances-along-with-TopN-based-...

 

Regards,

VKB

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.