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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
strangerMike
Helper II
Helper II

How can I do a calculation with the values shown in this matrix?

 

Please see this Matrix below:

 If I need to calculate a percentage based on two of these fields can it be done across the board?

 

In other words, is there away to divde the line "# of Bounces" by "# emails Sent" to come up with a percentage?

 

Even if it resides out side of the matrix, maybe in it's own table?  (and do it for each column?)

 

report.PNG

 

Thanks for looking at this.

3 REPLIES 3
v-yuezhe-msft
Microsoft Employee
Microsoft Employee

Hi @strangerMike,

I make a test using the following sample data.
1.PNG

Firstly, add a index column in Query Editor of Power BI Desktop.

Secondly, create a column using DAX below.

prevalue = IF(
Table1[Type]=LOOKUPVALUE(Table1[Type],Table1[Index],Table1[Index]-1),
LOOKUPVALUE(Table1[Value],Table1[Index],Table1[Index]-1)
,0
)

Thirdly, calculate percentage using the following formula.

% percentage = DIVIDE(Table1[Value],Table1[prevalue],0)
2.PNG


If the above steps don't help, please help to post your table stucture and sample data.

Thanks,
Lydia Zhang

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

Thanks Lydia Zhang

 

I am a little confused (i am new to Power BI).  I actually have two posts going.  One is this one, to try and create the percentages I need dynamically when the matrix is built.

 

The second, I created a query (another dataset based of the same table) where I pre-calculate the percentages and try and show those amounts in it's own matrix.  However, all though Property, Channel, Campaign and BeginMonth are present in both views (tables), the slicers will not apply to the second matrix.   I did not want to bring this up here, because trying two different methods will be confusing. I only mention it so perhaps one way is better than the other and I should pursue just one. See this post if you want to try and figure out why interactions are not working:

https://community.powerbi.com/t5/Desktop/Matrix-and-Slicers/td-p/168123

 

 

But back to this post...

 

 

using # of Bounces and # email Sent as an example:

 

what am i doing with?

prevalue = IF(
Table1[Type]=LOOKUPVALUE(Table1[Type],Table1[Index],Table1[Index]-1),
LOOKUPVALUE(Table1[Value],Table1[Index],Table1[Index]-1)
,0
)

Data sample:

 

Capture1.PNG

 

From this I create measure to display this matrix:
Capture2.PNG

 

Input Record with new measures.

Capture3.PNG

 

Thank you

Hi @strangerMike,


Since you post another thread with same question, your thread will be solved in another thread.

Thanks,
Lydia Zhang

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

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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