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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Need Help on create the Measure

I am trying to create the Measure where the below table formation . Please help me how to create the Measure where it should count the recent transaction date based on ID as higher rank. Each Rank I want to calculate the total net amount , Paid Amount , Rejected Amount.  I attempted countrows with filter option & RankX but it showing error .

 

 

Transaction DateIDService CodeNet AmountPaid AmountRejected AmountManual mapping
7/7/2024CLA0001572502501001501st Received transaction
8/8/2024CLA00015725015015002nd Recived Transaction
6/6/2024CLA00058830520020001st Received transaction
6/6/2024CLA00059921328502851st Received transaction
6/6/2024CLA00057104611001101st Received transaction
7/7/2024CLA00059921328528502nd time received
7/7/2024CLA00057104611001102nd time received
8/7/2024CLA00057104611011003rd time Received
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello,rajendraongole1 ,thanks for your concern about this issue.

Your answer is excellent! And I would like to share some additional solutions below.
Hi,@Anonymous .I am glad to help you.
If the calculated columns don't fit your needs, here is what I calculated by creating a measure, which enables dynamic transformations based on the data in the visual.
In fact I only modified the code rajendraongole1  provided by using RANK().
measure:

 

M_Rank = 
VAR _rank=
RANK(DENSE,FILTER(ALL(Rknk),'Rknk'[ID]=MAX('Rknk'[ID])),ORDERBY('Rknk'[Transaction Date],DESC),DEFAULT)
RETURN _rank

 

 

vjtianmsft_0-1723436234297.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hello,rajendraongole1 ,thanks for your concern about this issue.

Your answer is excellent! And I would like to share some additional solutions below.
Hi,@Anonymous .I am glad to help you.
If the calculated columns don't fit your needs, here is what I calculated by creating a measure, which enables dynamic transformations based on the data in the visual.
In fact I only modified the code rajendraongole1  provided by using RANK().
measure:

 

M_Rank = 
VAR _rank=
RANK(DENSE,FILTER(ALL(Rknk),'Rknk'[ID]=MAX('Rknk'[ID])),ORDERBY('Rknk'[Transaction Date],DESC),DEFAULT)
RETURN _rank

 

 

vjtianmsft_0-1723436234297.png

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian

 

Anonymous
Not applicable

Acutally as per @rajendraongole1 I have done the calculated column and the measure as well added . it was worked well. @Anonymous Thanks for your update regarding the measure. It's working well also. 

rajendraongole1
Super User
Super User

Hi @Anonymous - create a new calculated column to calcuate the rank the transactions for each id.

Rank:

TransactionRank =
RANKX(
    FILTER(
        'Rknk',
        'Rknk'[ID] = EARLIER('Rknk'[ID])
    ),
    'Rknk'[Transaction Date],
    ,
    DESC,
    DENSE
)
 

rajendraongole1_1-1723140946005.png

create measures to calculate the total Net Amount, Paid Amount, and Rejected Amount

TotalNetAmount =
CALCULATE(
    SUM('Rknk'[Net Amount]),
    FILTER(
        'Rknk',
        'Rknk'[TransactionRank] = 1
    )
)
 
total paid amount measure:
 
TotalPaidAmount =
CALCULATE(
    SUM('Rknk'[Paid Amount]),
    FILTER(
        'Rknk',
        'Rknk'[TransactionRank] = 1
    )
)
 
total rejected amount measure : 
 
TotalRejectedAmount =
CALCULATE(
    SUM('Rknk'[Rejected Amount]),
    FILTER(
        'Rknk',
        'Rknk'[TransactionRank] = 1
    )
)

 

Hope it helps, replace with your table name as per your model.

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Anonymous
Not applicable

@rajendraongole1 Thanks for your reply. That means rank always should be calculated column . I have done same earlier in microsoft excel data model . Unfortunately I couldnt do as rank Measure for better performance. correct me if I am wrong, so Everytime I should create calculated column in the Model where the data range is changing( adding new data weekly once).  

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.