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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
cottrera
Post Prodigy
Post Prodigy

DAX Switch Help

Hi hopefully I explain this correctly

 

I have a table of completed property repairs in my report.  I have used DAX to perform a simple count of these completed  repairs (Repairs = COUNTROWS(Repairs_Table) my company need to post inspect a % of these repairs. The % needs to change based on the count of repairs. 

 

I have another table which repairJobs and the % for which I would like to apply. For example if we complete 5 repairs I would like to work out 20% or if we complete 14 repairs we could like to work out 

14%.3 (see table example below)

 

I am asuming the SWITCH function could be used? 

 

Example of % table

Table_Percentages 
Jobs%
1100.0%
250.0%
333.3%
425.0%
520.0%
616.7%
714.3%
812.5%
911.1%
1020.0%
1118.2%
1216.7%
1315.4%
1414.3%

 

thanks

Richard

1 ACCEPTED SOLUTION

Hi yes 

 

I was over complicating things and realised that I done need to switch/ look up a choice of many differenct percentages to apply to my table. In fact I only need to apply a choice of two percentages depending on my count results. See below.

 

Calc Targets = IF(AND([Comp Repairs]>=1,[Comp Repairs]<=10),"0.05")&IF(AND([Comp Repairs]>=10,[Comp Repairs]<=40),"0.1")

View solution in original post

7 REPLIES 7
cottrera
Post Prodigy
Post Prodigy

Hi 

 

I am unable to add a sample report. But will try to explain

The results table is fine appart from the % column which is what I am trying to populate.

So If we tale line one as an example 'Team1' who completed  just 6 jobs.  I need to go and check my static percentages table and cross reference 6 jobs to find out what % need to be added to the results column called '%'

 

Results Table (Changes based on dates slicer)
TeamRepairs Completed (Count ROws)%
 

 

 
Team 1616.7% 
Team 21020.0% 
Team 3812.5% 
Team 4520.0% 
Team 5812.5% 
Team 61414.3% 
Team 71216.7% 
Team 81020.0% 
Team 91216.7% 

 

Table_Percentages (Static table)
Jobs%
1100.0%
250.0%
333.3%
425.0%
520.0%
616.7%
714.3%
812.5%
911.1%
1020.0%
1118.2%
1216.7%
1315.4%
1414.3%

 

Hope this explains it

Hello to all responders. I manged to resolve this issue myself by rethinking and applying a more simplified solution.

@cottrera Awesome! Glad you resolved this. Please can you post what you did so we can all learn? Then you can mark it as the solution.

Cheers!

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Hi yes 

 

I was over complicating things and realised that I done need to switch/ look up a choice of many differenct percentages to apply to my table. In fact I only need to apply a choice of two percentages depending on my count results. See below.

 

Calc Targets = IF(AND([Comp Repairs]>=1,[Comp Repairs]<=10),"0.05")&IF(AND([Comp Repairs]>=10,[Comp Repairs]<=40),"0.1")

hi  @cottrera 

First, It's pleasant that your problem has been solved by yourself.

and for your case, I think there is another simple measure that try to use LOOKUPVALUE to get it:

Result = LOOKUPVALUE(Table_Percentages[%],Table_Percentages[Jobs],[Repairs])

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@cottrera , The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.


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
Greg_Deckler
Community Champion
Community Champion

@cottrera Sorry, having trouble following, can you post sample data as text and expected output? Which did you post, source data or output? Whichever it is, please post the other


Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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.

Top Solution Authors