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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dofrancis3
Resolver I
Resolver I

Create data modole and Calculate percentage from two Tables

Dear estimated Colleagues,

Please i reachout to you because i need your help !
As you can see in the screenshoot below i have Two tables and I would like to calculate the percentage of achievement by category and by country or/and year.
Could you help me with DAX Mesure and the way to create data model thank you in advance for you support. 

 

Table Actual

CountryYearDT1DT2IPMCV
DRC20202078435
DRC20212071011
DRC202215509
DRC20202553040
Nigeria2021674033
Nigeria20202164
Nigeria20224015555
Nigeria202211629
Mauritania2020696812
Mauritania2021213740
Mauritania20221812223
Mauritania2023713109

 

 

Table Target

CountryCategoryTarget
DRCDT1120
DRCDT245
DRCIP53
DRCMCV89
NigeriaDT1136
NigeriaDT223
NigeriaIP180
NigeriaMCV70
MauritaniaDT193
MauritaniaDT277
MauritaniaIP55
MauritaniaMCV39
5 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

First step is to bring your data into a usable format by unpivoting it

 

lbendlin_0-1752015757908.png

 

 

Then you can decide if you want to use a data model or TREATAS  (which is easier in your example)

lbendlin_1-1752016106532.png

and then you can decide which of these values make sense and which need to be suppressed with BLANK().

 

 

 

 

 

View solution in original post

FBergamaschi
Solution Specialist
Solution Specialist

You do not have it but if you unpivot you do have it like @lbendlin  outlined

 

I confrim his numbers and to let you check that this is correct I oncluded Actual and Target calculation, your 121 % is not clear how you calculated that as it seems you sum the actual of all categories in a year and in a country (DRC 2020, total actual 146 considering all categories) and then compare it to the target of one single category in the sam country (DRC DT1 target 120) so it is unclear what you want to do. Also, the target to not have any year, are they the same every year?

 

image.png

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

View solution in original post

Dear @lbendlin thank you so much that's exactly what I was looking for.

@FBergamaschi 

View solution in original post

You can create a group for these scenarios, or if the granularity is not needed you can aggregate your data already in Power Query.

lbendlin_0-1752152700359.png

 

View solution in original post

Dear @lbendlin thank you so much for your support it's perfectly work

View solution in original post

13 REPLIES 13
FBergamaschi
Solution Specialist
Solution Specialist

You do not have it but if you unpivot you do have it like @lbendlin  outlined

 

I confrim his numbers and to let you check that this is correct I oncluded Actual and Target calculation, your 121 % is not clear how you calculated that as it seems you sum the actual of all categories in a year and in a country (DRC 2020, total actual 146 considering all categories) and then compare it to the target of one single category in the sam country (DRC DT1 target 120) so it is unclear what you want to do. Also, the target to not have any year, are they the same every year?

 

image.png

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Dear @FBergamaschi  thank you for your support but i have an issue:

1). Should i unpivot all colomns?

2). How can i Summarize (combine/merge) values of "DT1 and DT2" to DT

That means i will have only "DT", "IP" and "MCV".

dofrancis3_0-1752128998663.png

Thank you for your feed-back.

v-dineshya
Community Support
Community Support

Hi @dofrancis3 ,

Thank you for reaching out to the Microsoft Community Forum.

 

Hi @lbendlin , Thank you for your prompt response.

 

Hi @dofrancis3 , If @lbendlin , response has resolved your issue, Please mark his response as  “Accept it as a solution”  to assist other community members in resolving similar issues more efficiently.

Regards,

Dinesh

FBergamaschi
Solution Specialist
Solution Specialist
lbendlin
Super User
Super User

First step is to bring your data into a usable format by unpivoting it

 

lbendlin_0-1752015757908.png

 

 

Then you can decide if you want to use a data model or TREATAS  (which is easier in your example)

lbendlin_1-1752016106532.png

and then you can decide which of these values make sense and which need to be suppressed with BLANK().

 

 

 

 

 

Dear @lbendlin thank you so much for your support it's perfectly work

Dear @lbendlin thank you for your support but i have an issue

1). Should i unpivoting all the colomns?

2). How can i Summarize (combine/merge) values of "DT1 and DT2" to DT

That means i will have only "DT", "IP" and "MCV".

dofrancis3_0-1752102444151.png

 

Thank you for your feed-back.

You can create a group for these scenarios, or if the granularity is not needed you can aggregate your data already in Power Query.

lbendlin_0-1752152700359.png

 

Dear @lbendlin thank you so much that's exactly what I was looking for.

@FBergamaschi 

Dear @lbendlin Thank you for your reply but as you can see the result isn't good apparently the formula isn't good the rusult should be the same (the formula is DT1+DT2+IP+MCV/ TARGET)

Please support 

dofrancis3_0-1752051005506.png

@FBergamaschi 

Not yet the srtucture of data is different 

Dear @FBergamaschi please support 

dofrancis3_0-1752055978915.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.