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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RRush
Regular Visitor

Trying to Get a Max Rate for a Customer, filter that rate and see all open Accounts for Customer

I am working on a report on which I want to filter our customers by a Rate Variance Group.  The customer would fall into a group based on the Max Rate Variance for all of their deposit accounts.  But, if a customer falls in that range I want to see all open accounts for the customer so I can evaluate the total relationship.  To do this I used "All Selected" so I can see all accounts for the customer.  The issue is that now I cannot filter the "Closed Accounts".

    

I have what you see in the example below and I have a slicer with a Rate Variance Groups is working.  

 

Example:


Customer Name         Account Number      Account Status              Max Rate Variance     Rate Variance for Deposit Account

ABC Company              123456                          Open                                  1.25                                       .75

ABC Company               85755                           Open                                  1.25                                     1.25

ABC Company               22225                           Closed                                  .25                                      .50

 

This is my current DAX establishing my slicer and my "Max Rate Variance" calculation.

 

MaxRateVariance =
VAR low = SELECTEDVALUE('Group-Deposit Rate Variance Group'[Low Range])
VAR high = SELECTEDVALUE('Group-Deposit Rate Variance Group'[High Range])
VAR cust = SELECTEDVALUE('Account Common'[Customer Number])
Var calc =
    MAXX(
        CALCULATETABLE(
        VALUES('Account Common'[Account Number]),
        ALLSELECTED('Account Common'[Account Number])
        ),
         [Rate Variance (Deposits)]
    )  
VAR result =
    SWITCH(TRUE(),
        calc >= low && calc <= high, calc
    )
Return
    IF(HASONEVALUE('Account Common'[Customer Name and Customer Number]),
        calc,
        BLANK()
    )

 

 

1 ACCEPTED SOLUTION
BeaBF
Super User
Super User

@RRush Hi! Try with:

MaxRateVariance =
VAR low = SELECTEDVALUE('Group-Deposit Rate Variance Group'[Low Range])
VAR high = SELECTEDVALUE('Group-Deposit Rate Variance Group'[High Range])
VAR cust = SELECTEDVALUE('Account Common'[Customer Number])
VAR calc =
MAXX(
CALCULATETABLE(
VALUES('Account Common'[Account Number]),
REMOVEFILTERS('Account Common'[Account Number]),
'Account Common'[Account Status] = "Open"
),
[Rate Variance (Deposits)]
)
VAR result =
SWITCH(
TRUE(),
calc >= low && calc <= high, calc
)
RETURN
IF(
HASONEVALUE('Account Common'[Customer Name and Customer Number]),
calc,
BLANK()
)

 

Then, create a Separate Measure to Filter Closed Accounts:

IncludeInReport =
IF(
'Account Common'[Account Status] = "Open",
1,
0
)

Add this measure as a visual-level filter with the condition IncludeInReport = 1

 

BBF

View solution in original post

4 REPLIES 4
RRush
Regular Visitor

BBF,

 

      Thanks so much!  That worked and I appreciate your expertise!!!

BeaBF
Super User
Super User

@RRush Hi! Try with:

MaxRateVariance =
VAR low = SELECTEDVALUE('Group-Deposit Rate Variance Group'[Low Range])
VAR high = SELECTEDVALUE('Group-Deposit Rate Variance Group'[High Range])
VAR cust = SELECTEDVALUE('Account Common'[Customer Number])
VAR calc =
MAXX(
CALCULATETABLE(
VALUES('Account Common'[Account Number]),
REMOVEFILTERS('Account Common'[Account Number]),
'Account Common'[Account Status] = "Open"
),
[Rate Variance (Deposits)]
)
VAR result =
SWITCH(
TRUE(),
calc >= low && calc <= high, calc
)
RETURN
IF(
HASONEVALUE('Account Common'[Customer Name and Customer Number]),
calc,
BLANK()
)

 

Then, create a Separate Measure to Filter Closed Accounts:

IncludeInReport =
IF(
'Account Common'[Account Status] = "Open",
1,
0
)

Add this measure as a visual-level filter with the condition IncludeInReport = 1

 

BBF

v-zhengdxu-msft
Community Support
Community Support

Hi @RRush 

 

Could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

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

some_bih
Super User
Super User

Hi @RRush without model and other details, like relationships it is hard to spot issue. Especially, as your measure is using function ALLSELECTED (bit a "special" function suggested to be used in visual).

Nevertheless, check your measure definition [Rate Variance (Deposits)] or provide simple file with input and expected output for possible solutions.





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

Proud to be a Super User!






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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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