Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hi guys,
I am trying to use this code to show the figure for Gross Profit, EBITDA and Net Profit.
The logic will be using this DAX Code to run through the title coloumn, whenever it sees column matching the description "Gross Profit", "EBITDA", "Net Profit", it will use my measures I created to calculate the relevant figure.
However it is not showing figures somehow. There must be some error within my DAX formula. Much appreciate if someone can help.
Solved! Go to Solution.
Hi @AZ2021 ,
Based on solution provided, you need to update your code as below
SelectedYearActual =
VAR CurrentItem =
MAX ( Mapping[COA - Level 1] )
RETURN
SWITCH (
TRUE (),
SEARCH ( "Gross Profit", CurrentItem,, 0 ) > 0, [Gross Profit],
SEARCH ( "EBITDA", CurrentItem,, 0 ) > 0, [EBITDA],
SEARCH ( "Net Profit", CurrentItem,, 0 ) > 0, [Net Profit],
CALCULATE ( [Correct sign figure] )
)Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
@AZ2021 , change selectedvalue with MAX. and check. Also, check are there is any space in the name. or use search in place of =
example
Switch(true() ,
search("Gross Profilt", max(Mapping[COA level 1]),,0) >0, [Gross profit],
// Add others
)
Hi amitchandak,
Thank you for your response. I replaced my code with your suggestion but an error pop.
Hi @AZ2021 ,
Based on solution provided, you need to update your code as below
SelectedYearActual =
VAR CurrentItem =
MAX ( Mapping[COA - Level 1] )
RETURN
SWITCH (
TRUE (),
SEARCH ( "Gross Profit", CurrentItem,, 0 ) > 0, [Gross Profit],
SEARCH ( "EBITDA", CurrentItem,, 0 ) > 0, [EBITDA],
SEARCH ( "Net Profit", CurrentItem,, 0 ) > 0, [Net Profit],
CALCULATE ( [Correct sign figure] )
)Thanks,
Samarth
Best Regards,
Samarth
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!