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
GunnerJ
Post Patron
Post Patron

Adding another set of criteria to filter

My goal is to show pending accounts as of any date. The measure below was adapted from the "Active Accounts" version. For the measure below I need to add another set of critera within the filter. 

 

Specifically needing to add where column [ACTION_FLAG] = "PENDING". However when I try typing the column name it doesn't show up in the pop up so I can't reference it. Just looking for a nudge in the right direction on how to further filter this measure. 

Pending_Accounts = 
      
         Countx(
            Filter(
                Values('TEST CHARGES'[BI_ACCT]),
                 [total as of date] = 0 
            ) , [BI_ACCT]
        )

 

1 ACCEPTED SOLUTION

Pending_Accounts =
        CALCULATE(
            Countx(
             Filter(
                Values('TEST CHARGES'[BI_ACCT]),
                 [total as of date] < 1
                ) , [BI_ACCT]
            ),  'TEST CHARGES'[ACTION_FLAG] <> "STOP"
        )

View solution in original post

6 REPLIES 6
parry2k
Super User
Super User

@GunnerJ it is pretty much the solution that I posted, just need to tweak the conditions. good job!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

v-stephen-msft
Community Support
Community Support

Hi @GunnerJ ,

 

If you want to reference a column in a measure, we often use the MAX()/MIN() to reference or use the FILTER() to filter the column.

The sample file you provided appears to have been deleted.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@GunnerJ try this:

 

Pending_Accounts = 
      CALCULATE (
         Countx(
            Filter(
                Values('TEST CHARGES'[BI_ACCT]),
                 [total as of date] = 0 
            ) , [BI_ACCT]
        ), Table[Action_Flag] = "Pending"
)

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k thank you for the reply. I'd tried that previously but the measure is flagging if the account had ever been pending and seems to then ignore the part where "total as of date" is = 0.  I've provided an example.

 

Total as of date shows a value of 2 for this account but the pending accounts measure is still flagged. Total as of date would change to 0 if the date filter was set between Aug 21st-Sept 19th 2017. Since it's not within that date range and the value is not 0 I'd hope to have the pending accounts measure not flag. 

 

GunnerJ_0-1660946703676.png

total as of date = 
var last_date = CALCULATE( LASTNONBLANK('TEST CHARGES'[CHG_DATE], ""), 'TEST CHARGES'[CHG_DATE] <= max('Test Charges Date Table'[Date]))
return CALCULATE(min('TEST CHARGES'[RUNNING_TOTAL]), 'TEST CHARGES'[CHG_DATE] = last_date)

 

Any modifications you might suggest?

@parry2k 
Here is a link to the sample file if it is of use to you. Thank you
https://www.dropbox.com/s/ylz8e36jg8f309o/test%20active%20charges.pbix?dl=0

Pending_Accounts =
        CALCULATE(
            Countx(
             Filter(
                Values('TEST CHARGES'[BI_ACCT]),
                 [total as of date] < 1
                ) , [BI_ACCT]
            ),  'TEST CHARGES'[ACTION_FLAG] <> "STOP"
        )

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.