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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
PratikVyas
Frequent Visitor

How to One table entry no find in check CLosed by Entry no then value Sum in one variable

How to One table entry no find in check CLosed by Entry no then value Sum in one variable
 

For your reference,

table details 

One table nmae is Cust_LedgEntry Entry no Coloumn check and find entry no . in same table in other coloum CLosedBY ENtry no. then if match entry after value sum in one variable entrywise. it is possible or not?

 

Cust Ledg Entry
Document TypeCustomer posting GroupDocument_NoEntry_No_Collec_AmtinrClosedbyENtrymeas
InvoiceExportud/24-25/0001123500 
Payment pay/24-25/0001487500123
InvoiceDomesticud/24-25/00021251000 
Payment pay/24-25/0002498500125
Payment pay/24-25/0002490300125
      
      
Result     
Document TypeCustomer posting GroupDocument_NoEntry_No_Collec_AmtinrAPPLIED AMT(CR)
InvoiceExportud/24-25/0001123500500
InvoiceDomesticud/24-25/00021251000800
      
      
      
Group Result   
Customer posting GroupCollec_AmtinrAPPLIED AMT(CR)   
Export500500   
Domestic1000800
1 ACCEPTED SOLUTION

Hi @PratikVyas ,

Do you mean this is a new table?'APPLIED AMT(CR)' is the result you need, right?

vzhouwenmsft_0-1726037382971.png

Use the following DAX expression to create a measure

APPLIED AMT =
VAR _result =
    ADDCOLUMNS (
        'Cust Ledg Entry',
        "APPLIED AMOUNT",
            SUMX (
                FILTER (
                    'Cust Ledg Entry',
                    [ClosedbyENtrymeas] = EARLIER ( 'Cust Ledg Entry'[Entry_No_] )
                ),
                [Collec_Amtinr]
            )
    )
VAR _group =
    SELECTEDVALUE ( 'Group Result'[Customer posting Group] )
RETURN
    SUMX ( FILTER ( _result, [Customer posting Group] = _group ), [APPLIED AMOUNT] )

vzhouwenmsft_1-1726038932396.png

 

Best Regards,
Wenbin Zhou

View solution in original post

7 REPLIES 7
ahadkarimi
Solution Specialist
Solution Specialist

Hi @PratikVyas, you will need to create a calculated column to find the corresponding matching Entry_No_ based on the ClosedbyENtrymeasgive, trye these and if you encounter any issues, let me know.

MatchedAmount = 
IF (
    NOT(ISBLANK('Cust_LedgEntry'[ClosedbyENtrymeas])),
    CALCULATE (
        SUM('Cust_LedgEntry'[Collec_Amtinr]),
        FILTER (
            'Cust_LedgEntry',
            'Cust_LedgEntry'[Entry_No_] = EARLIER('Cust_LedgEntry'[ClosedbyENtrymeas])
        )
    ),
    BLANK()
)

Next, create a calculated measure:

AppliedAmount = 
SUMX (
    FILTER (
        'Cust_LedgEntry',
        'Cust_LedgEntry'[Entry_No_] = 'Cust_LedgEntry'[ClosedbyENtrymeas]
    ),
    'Cust_LedgEntry'[Collec_Amtinr]
)
GroupResult = 
SUMX (
    'Cust_LedgEntry',
    'Cust_LedgEntry'[Collec_Amtinr] + 'Cust_LedgEntry'[MatchedAmount]
)

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Specialist!

PratikVyas_0-1725933782317.png

 

Error getting

i am selecting Earlier function

Hi ahadkarimi ,thanks for the quick reply, I'll add more.

Hi @PratikVyas ,

Please make sure you create a calculated column and not a measure. 'Earlier' funciton requires row context to calculate. Or you can try this.

Column = 
VAR _Entry_No_ = [Entry_No_]
RETURN SUMX(FILTER('Cust_LedgEntry',[ClosedbyENtrymeas] = _Entry_No_),[Collec_Amtinr])

vzhouwenmsft_0-1725949551980.png

If I understand wrongly, please correct me.

 

Best Regards,
Wenbin Zhou

@v-zhouwen-msft  it is working fine but i want to result is 

Customer posting group , Collect_AMtinr and Column value this scenario is not working

Group Result   
Customer posting GroupCollec_AmtinrAPPLIED AMT(CR)   
Export500500   
Domestic1000800

Hi @PratikVyas ,

Do you mean this is a new table?'APPLIED AMT(CR)' is the result you need, right?

vzhouwenmsft_0-1726037382971.png

Use the following DAX expression to create a measure

APPLIED AMT =
VAR _result =
    ADDCOLUMNS (
        'Cust Ledg Entry',
        "APPLIED AMOUNT",
            SUMX (
                FILTER (
                    'Cust Ledg Entry',
                    [ClosedbyENtrymeas] = EARLIER ( 'Cust Ledg Entry'[Entry_No_] )
                ),
                [Collec_Amtinr]
            )
    )
VAR _group =
    SELECTEDVALUE ( 'Group Result'[Customer posting Group] )
RETURN
    SUMX ( FILTER ( _result, [Customer posting Group] = _group ), [APPLIED AMOUNT] )

vzhouwenmsft_1-1726038932396.png

 

Best Regards,
Wenbin Zhou

Thanks it is working.

But it is possible no need to new table. Calulation on one table  Cust_LedgEntry

 

Hi PratikVyas,

After creating the calculated column using my method, create a 'Table' visual. Put 'Customer posting Group' in it. Create two measures.

vzhouwenmsft_0-1727070457206.png

Measure = IF(SELECTEDVALUE('Table'[Customer posting Group]) = BLANK(),BLANK(),SUM('Table'[Collec_Amtinr]))
Measure 2 = IF(SELECTEDVALUE('Table'[Customer posting Group]) = BLANK(),BLANK(),SUM('Table'[Column]))

 

Best Regards,
Wenbin Zhou

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.