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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BaldAccountant
Helper II
Helper II

Selected value based on which slicer with multiple slicers

I work in healthcare so I can't provide data for this question.

I am trying to set up a tab in Power BI desktop with Slicer A, Slicer B, and Slicer C one for each row of cards.  The slicers would have types of calculations to chose from, for example cost of the case, the time it took, or the profit from the case.  I want to be able to chose one of those calcs for each line cards, find the account with the highest amount for that type of figure (for eaxmple the highest case cost)  Then the cards in each row would display certain stats for that account.  So for the account with the highest costs the row with Slicer A can be set to Cost and for the account with the highest cost it will display the cost for that account, the time it took, the reimbursement and net income for that same account.  

The problem I am having is that the cards for the first row of the report don't show account and figures for the account with the highest amount in that calculation on the slicer.  Instead it shows the account that I would get if I left the slicer blank. All the other slicers work the way I want.  I tried to use the edit interactions option to make sure the other slicers are not controlling the slicer and cards for the first row, but that does not make a difference.

Here is the measure I use in each card:

Max Acct DYN = var maxacct = maxx(TOPN(1,values(DATA3[PATIENT NUMBER]),CALCULATE(Analysis[Analysis Measure])),DATA3[PATIENT NUMBER])
Return
CALCULATE(Analysis[Analysis Measure2],DATA3[PATIENT NUMBER]=maxacct)
The formula in the Maxacct variable determines the accountnumber has the highest value that is chosen on the slicer for that row, the formula after return uses that account number to calculate each card.  
The  slicer is used to determine the analysis measure and the Analysis Measure2 determines what calculation to apply to the account bases on a value that is filtered on the card.  For example if on the slicer for cost and then the card had the analysis measure2 for Net Profit, the card would show the net profit for the account with the highest cost.  
Like I said I can't give you any real data.
1 ACCEPTED SOLUTION
ahadkarimi
Solution Specialist
Solution Specialist

@BaldAccountant, try this code, and if you encounter any issues, let me know.

Max Acct DYN = 
VAR SelectedMeasure = SELECTEDVALUE(SlicerTable[SlicerColumn]) 
VAR MaxAccount = 
    MAXX(
        TOPN(1, 
            FILTER(
                ALL(DATA3), 
                [Analysis Measure] = SelectedMeasure
            ), 
            [Analysis Measure], 
            DESC
        ), 
        DATA3[PATIENT NUMBER]
    )
RETURN
CALCULATE(
    [Analysis Measure2], 
    DATA3[PATIENT NUMBER] = MaxAccount)

 

View solution in original post

1 REPLY 1
ahadkarimi
Solution Specialist
Solution Specialist

@BaldAccountant, try this code, and if you encounter any issues, let me know.

Max Acct DYN = 
VAR SelectedMeasure = SELECTEDVALUE(SlicerTable[SlicerColumn]) 
VAR MaxAccount = 
    MAXX(
        TOPN(1, 
            FILTER(
                ALL(DATA3), 
                [Analysis Measure] = SelectedMeasure
            ), 
            [Analysis Measure], 
            DESC
        ), 
        DATA3[PATIENT NUMBER]
    )
RETURN
CALCULATE(
    [Analysis Measure2], 
    DATA3[PATIENT NUMBER] = MaxAccount)

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.