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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
EraDon
Frequent Visitor

Calculate function does not apply filter from visual in row context

Hi

I have a simple DAX to calculate row by row transaction as follow.

Overdue Balance = calculate(sumx(DTransactions,DTransactions[TransactionAmount] - DTransactions[AllocatedAmount]),DTransactions[StatementNumber] <> 0)
 
just simply I need to sumx TransactionAmount - AllocateAmount which statementNumber is not equal to 0.
EraDon_0-1652922176388.png
 But I get the total value of the sum for each statement number.  Why visual filter didn't apply here?
 
However, If I put the filter function, it will give the correct result.
Overdue Balance 2 = sumx(FILTER(DTransactions,DTransactions[StatementNumber] <> 0),DTransactions[TransactionAmount] - DTransactions[AllocatedAmount])
EraDon_2-1652922431524.png

 

DebtorTansaction is the fact table.  Overdue3 is a test for the ALL function with Filter (It is the correct value). 

 

Thanks

 

2 REPLIES 2
amitchandak
Super User
Super User

Hi amitchandak,

 

Thanks for the reply. I totally understand your link explanation.

I tried to understand why calculate function didn't take the Statement number as an incoming filter. I think what happens is I said to get all transactions statement number is not equal to 0. So, the calculate function does sumx (row context) as everything one set. it cannot transfer the context again as statementnumber is not a valid incoming filter.

 

Regards

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.