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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
kc_1116
Frequent Visitor

Need help in using Field Parameter in Top N filter and Conditional Formatting

Hi,

 

I have a report that has conditional formatting and Top N filter on a static measure named IRR and it works perfectly. However, I want to change the measure to dynamic and allow user to select among a few other measures like DPI, RVPI and TVPI. I have created a Field Parameter and add all measures to it. It works for the bar chart at the bottom. However, I couldn't get the conditional formating to work. Also, the Top N filter based on that field parameter is not working properly. Can you advise how can I fix them, please? Thanks in advance.

 

URL of my Power BI Report: https://github.com/chris-kc-cheng/ftk-powerbi/blob/main/Private%20Markets.pbix

 

ask.png

 

 

1 ACCEPTED SOLUTION
DataNinja777
Super User
Super User

Hi @kc_1116 ,

 

In order to create conditional formatting for your bar chart, you can create a measure like below:

Selected Metric Value = 
VAR Selection = SELECTEDVALUE('Metric Selector'[Metric Selector Order])
RETURN
SWITCH( Selection,
    0, [M_IRR],
    1, [M_DPI],
    2, [M_RVPI],
    3, [M_TVPI],
    [M_IRR]
)

Then you can apply conditional color formatting in the bar:

DataNinja777_1-1764334845645.png

Set the conditional formatting like below:

DataNinja777_2-1764334910457.png

The resultant output is as shown blow:

 

 

I have attached an example pbix file for your reference:


Best regards,

 

 

View solution in original post

4 REPLIES 4
Punithurs
Frequent Visitor

Hi, 
Refer to this short video for Top N filtering logic walkthrough. 
https://www.youtube.com/watch?v=gnCHB5jBQbA&t=15s 

Thanks, 
Punith

DataNinja777
Super User
Super User

Hi @kc_1116 ,

 

In order to create conditional formatting for your bar chart, you can create a measure like below:

Selected Metric Value = 
VAR Selection = SELECTEDVALUE('Metric Selector'[Metric Selector Order])
RETURN
SWITCH( Selection,
    0, [M_IRR],
    1, [M_DPI],
    2, [M_RVPI],
    3, [M_TVPI],
    [M_IRR]
)

Then you can apply conditional color formatting in the bar:

DataNinja777_1-1764334845645.png

Set the conditional formatting like below:

DataNinja777_2-1764334910457.png

The resultant output is as shown blow:

 

 

I have attached an example pbix file for your reference:


Best regards,

 

 

Amazing. Your DAX magically solved both the conditional formatting and Top N filter problems. Thanks so much for your help.

amitchandak
Super User
Super User

@kc_1116 , I think the main idea would be to know the selected measure and have conditional formatting based on that . Check if the below method can help 

Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.