Forum Discussion
nattran
Helper I
6 years agoDAX query to return multiple results
Hi, I'm currently trying to set up a Gross Margin report. Here is the layout it should look: Region Revenue Total Revenue Salaries Contract Cost Total Cost GM = Rev - Tot...
- 6 years ago
Hi nattran ,
So, you want to show 2450 like "2450(79%)" and show "8440" just as "8440". Right?
If so, try this:
Actuals = VAR Revenue = CALCULATE ( SUM ( Rev[PD_TOT] ), Report[ACCGROUP] = 1 ) * -1 VAR Expense = CALCULATE ( SUM ( Rev[PD_TOT] ), Report[ACCGROUP] = 2 ) VAR GM = Revenue - Expense VAR GM_Percent = ROUND ( GM / Revenue, 2 ) RETURN IF ( HASONEFILTER ( 'YourTableName'[groupname] ),----The second level column in your Matrix Rows field. GM, IF ( HASONEFILTER ( 'YourTableName'[Partner Name] ),----The first level column in your Matrix Rows field. GM & " ( " & GM_Percent * 100 & "% )", GM ) )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
6 years agonattran , Try all as a separate measure
Revenue = Calculate(sum(Rev[PD_TOT]),Report[ACCGROUP]=1)*-1
Expense = Calculate(sum(Rev[PD_TOT]),Report[ACCGROUP]=2)
GM = Revenue - Expense
GM %= divide([Revenue] - [Expense],[Revenue])
Please Watch/Like/Share My webinar on Time Intelligence: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184
My Youtube Tips at: https://www.youtube.com/playlist?list=PLPaNVDMhUXGYrm5rm6ME6rjzKGSvT9Jmy
Appreciate your Kudos.