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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

How to have an IF statements "if true" Result only apply to what is filtered.

So I have two tables, one contains payment history another contains account information, they are related by accounts.

 

I created this if statement: IF( calculate (sum($), transactions date <= dateadd(accountenterdate,3,months))=0, 0, else calculate (sum($), transactions date <= dateadd(accountenterdate,3,months)))

 

 

This is the problem, I want the average per account so im using this if statement in an AverageX statement, so that for each row it will calculate how much was paid within 3 months of being booked. For instance I have 8 accounts that were entered on the account table, 7 of the accounts paid and have a transacion history, 1 account did not. So when I do the averagex statement it takes the average of the 7 accounts that paid and are on the transaction table. How can I change it so that even if the account does not have payment history it is still included in the average. 

 

right now if i filter to a group of accounts that totals to 8, 7 of which paid, because of the if statement 0 will be provided for all accounts outside the group that made a payment but not the 1 account that has no transaction history. Is there a DOES NOT EXIST option? 

 

 

1 REPLY 1
speedramps
Community Champion
Community Champion

We want to help you but your description is too vaugue.  Please write it again clearly.

DON'T copy & paste DAX that does not work and expect us to fathom what it is supppsed to do. That is crazy!!! 😀

 

DO give a non technical functional decscription. 

 

Provide example input data as table text (not a screen print) so we can import the data to build a soution for you.
Also provide the example desired output, with a clear description of the process flow.

Don't share private data.

Take care to use the same table and field names in the input, output and description so we can understand your problem and help you.

You will get a quick response if you put time and effort into writing clear problem descriptions.

Vaugue descriptions waste your time and ourtime.

Look foward to helping you when the above information is forthcoming.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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