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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Ratio calculation at lowest account

Hi I am looking to calculate within a table the expense ratio for multiple accounts, so that I can rollup their percentages to get to the total expense ratio. i.e. Rent Expense/ Earned Premium. Below is how I would like my table to look column C would be a calculated column that just divides column B by Earned premium.

 

AccountAmountRatio
Rent15037.5%
Salary20050.0%
Commission18045.0%
Earned Premium400100%

 

Thank you!

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@Anonymous 

Column = 
DIVIDE([Amount],
LOOKUPVALUE('Table'[Amount],'Table'[Account],"Earned Premium",'Table'[Region],[Region])
)

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

13 REPLIES 13
JustJan
Responsive Resident
Responsive Resident

Hi @Anonymous 

 

Assuming the 100% is always from the Earned Premium line, you could create a measure like: 

 

M1 =
Var AmountEP = calculate(sum('Table'[Amount]),'Table'[Account] = "Earned Premium")
return divide(sum('Table'[Amount]), AmountEP)
 
Format it as a percentage to complete your table. 
 
az38
Community Champion
Community Champion

Hi @Anonymous 

try a calculated column

Column = 
DIVIDE([Amount],
LOOKUPVALUE('Table'[Amount],'Table'[Account],"Earned Premium")
)

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
JarroVGIT
Resident Rockstar
Resident Rockstar

You can download my example here:

https://1drv.ms/u/s!Ancq8HFZYL_aiIlEB5yDWLV_oX_pJw?e=6WJbLd

 

The calculated column is the following:

Ratio = DIVIDE('Table'[Amount], LOOKUPVALUE('Table'[Amount], 'Table'[Account], "Earned Premium"))

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @JarroVGIT and @az38 ,

 

Thank you for the quick response! Is it possible to do this if the accounts repeat for multiple regions? i.e the below:

 

RegionAccountAmountRatio
EastRent15037.5%
EastSalary20050.0%
EastCommission18045.0%
EastEarned Premium400100.0%
WestRent30042.9%
WestSalary40057.1%
WestCommission10014.3%
WestEarned Premium700100.0%

Hi @Anonymous ,

You can use this column:

Ratio = DIVIDE('Table'[Amount], LOOKUPVALUE('Table'[Amount], 'Table'[Account], "Earned Premium", Table'[Region], [Region]))

Let me know if this works 🙂

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




az38
Community Champion
Community Champion

@Anonymous 

Column = 
DIVIDE([Amount],
LOOKUPVALUE('Table'[Amount],'Table'[Account],"Earned Premium",'Table'[Region],[Region])
)

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Is there a way to take this one step further, so that I can calculate East's Ratios, West's Ratios and a Total Ratio? Right now I am running into issues where I have lines of business that rollup in a mapping table, but when I pull a parent LOB it sums up the underlying percentages rather than recalculating them

Something like this:

Ratio = 
IF(HASONEVALUE('Table'[Account]) && SELECTEDVALUE('Table'[Account]="Earned Premium",
   DIVIDE('Table'[Amount], LOOKUPVALUE('Table'[Amount], 'Table'[Account], "Earned Premium", Table'[Region], [Region])),
DIVIDE(
     CALCULATE(SUM('Table'[Amount]), FILTER(Table, 'Table'[Account] <> "Earned Premium")),
      CALCULATE(SUM('Table'[Amount]), FILTER(Table, 'Table'[Account] = "Earned Premium"))
)
)

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi @Anonymous ,

Did this solve your issue?

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @JarroVGIT ,

 

I am running into an error where is says that my column cannot be found or may not be used in this expression for the selectedvalue formula. Any idea why this might be?

 

Thanks,

PS1018

Just a tip for future reference: typing out DAX without any intellisense is very hard and error prone. If you don't provide screenshots, (complete) example data, pbix etc, it is very hard for me to pinpoint the problem. Can you share screenshots of the DAX and error perhaps? 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @JarroVGIT ,

 

Below is a screenshot of my Dax. I was using example data before that did not match my actual data. That is why the naming is different. 

 

Power BI.PNG

In the first line, you have SELECTEDVALUE('HFM Extract'[HFMAccount]="4100000") which should be SELECTEDVALUE('HFM Extract'[HFMAccount])="4100000".

Note the bracket place. 

 

Kind regards

Djerro123

-------------------------------

If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.

Keep those thumbs up coming! 🙂

 

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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