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

matrix percentage from another total

I want to create a matrix that  shows the percentage of paid invoices from total amount of invoices.

i have invoice-date, paymnt-date, invoice-amount, payment-amount

I have to show how much has been paid in Jan., Feb., Mar...etc from total Jan. invoice amount and so on for each month.

 

 

1 ACCEPTED SOLUTION
v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1644558303417.png

Here are the steps you can follow:

1. Create measure.

30 =
var _30=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=30))
var _all=CALCULATE(SUM('Table'[invoice-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_30,_all)
60 =
var _60=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=60))
var _all=CALCULATE(SUM('Table'[invoice-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_60,_all)
90 =
var _90=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=90))
var _all=CALCULATE(SUM('Table'[invoice-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_90,_all)
30_group =
var _30=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=30))
var _all=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_30,_all)
60_group =
var _60=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=60))
var _all=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_60,_all)
90_group =
var _90=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=90))
var _all=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_90,_all)

Result:

vyangliumsft_1-1644558303418.png

2. Use Enter data to create a slice table.

vyangliumsft_2-1644558303420.png

3. Create the measure again and change the values in the matrix by selecting the slicer.

30_select =
var _select=SELECTEDVALUE(Slice_Table[select])
return
IF(
    _select="Value",[30],[30_group])
60_select =
var _select=SELECTEDVALUE(Slice_Table[select])
return
IF(
    _select="Value",[60],[60_group])
90_select =
var _select=SELECTEDVALUE(Slice_Table[select])
return
IF(
    _select="Value",[90],[90_group])

4. Result:

Use [select] of Slice_Table as a slicer, and form a matrix with [Month], [30_select], [60_select], [90_select] of Table.

When the slicer is selected as Value, the matrix displays:

vyangliumsft_3-1644558303420.png

When the slicer is selected as Total value, the matrix displays:

vyangliumsft_4-1644558303421.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Thank you @v-yangliu-msft  it worked bu there is a small problem. total column gives wrong total 

 

rbahar006_0-1646819186163.png

 

Hi  @Anonymous ,

This is an error in the Total of the measure, you can use the HASONEVALUE() function to solve it:

Create measure:

30_Sum_Total =
VAR _table =
    SUMMARIZE ( 'Table', 'Table'[Month], "_value",[30] )
RETURN
    IF ( HASONEVALUE ( 'Table'[Month] ),[30], SUMX ( _table, [_value] )
)

60_Sum_Total =
VAR _table =
    SUMMARIZE ( 'Table', 'Table'[Month], "_value", [60] )
RETURN
    IF ( HASONEVALUE ( 'Table'[Month] ),[60], SUMX ( _table, [_value] )
)
90_Sum_Total =
VAR _table =
    SUMMARIZE ( 'Table', 'Table'[Month], "_value", [90] )
RETURN
    IF ( HASONEVALUE ( 'Table'[Month] ),[90], SUMX ( _table, [_value] )
)

Notice:

Don't forget to format each measure as a percentage

vyangliumsft_0-1646875356512.png

Result:

vyangliumsft_1-1646875356514.png

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

Whether your measure format is Whole number, you can select [60] measure, click % in Measure tools - to convert it to percentage format

vyangliumsft_0-1646817207413.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hello @v-yangliu-msft 

Got wrong results in 60 & 90 categories. What is wrong?

rbahar006_0-1646815536952.png

 

v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous ,

I created some data:

vyangliumsft_0-1644558303417.png

Here are the steps you can follow:

1. Create measure.

30 =
var _30=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=30))
var _all=CALCULATE(SUM('Table'[invoice-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_30,_all)
60 =
var _60=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=60))
var _all=CALCULATE(SUM('Table'[invoice-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_60,_all)
90 =
var _90=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=90))
var _all=CALCULATE(SUM('Table'[invoice-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_90,_all)
30_group =
var _30=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=30))
var _all=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_30,_all)
60_group =
var _60=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=60))
var _all=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_60,_all)
90_group =
var _90=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])&&'Table'[Group]=90))
var _all=CALCULATE(SUM('Table'[Payment-amount]),FILTER(ALL('Table'),'Table'[Month]=MAX('Table'[Month])))
return
DIVIDE(_90,_all)

Result:

vyangliumsft_1-1644558303418.png

2. Use Enter data to create a slice table.

vyangliumsft_2-1644558303420.png

3. Create the measure again and change the values in the matrix by selecting the slicer.

30_select =
var _select=SELECTEDVALUE(Slice_Table[select])
return
IF(
    _select="Value",[30],[30_group])
60_select =
var _select=SELECTEDVALUE(Slice_Table[select])
return
IF(
    _select="Value",[60],[60_group])
90_select =
var _select=SELECTEDVALUE(Slice_Table[select])
return
IF(
    _select="Value",[90],[90_group])

4. Result:

Use [select] of Slice_Table as a slicer, and form a matrix with [Month], [30_select], [60_select], [90_select] of Table.

When the slicer is selected as Value, the matrix displays:

vyangliumsft_3-1644558303420.png

When the slicer is selected as Total value, the matrix displays:

vyangliumsft_4-1644558303421.png

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Anonymous
Not applicable

TThank you @v-yangliu-msft It was so beneficial, however, the matrix doesn't show the results. rbahar006_0-1646725984985.png

What can I do in this case? 

TheoC
Super User
Super User

Hi @Anonymous 

 

Use the Matrix visual.  Drag "Invoice Number" on to the values. Convert it to Distinct Count using the little down arrow.  Add Months to the Columns of the Matrix Table. Go back to the "Invoice Number" count and then click on the down arrow again, go to "Show Value As" and then select Percent of Grand Total.

 

Hopefully that helps 🙂

Theo

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Anonymous
Not applicable

Thank you @TheoC but I'm looking for a matrix that contains invoice date as columns, payment date as rows, and the paid amount as a value but I need to present it as a percentage of invoice amount. if i chose show value as a percentage from grand total it will give paid amount per month from total paid amount. I need to check how many has been paid from the total invoice every single month. for example, I have to present that 60% of invoices has been issued in oct and paid in oct, while 9% of invoices has been issued in oct and paid in nov.. etc. Again I want the percentage to be paid amount/ invoice amount. 

 

Anonymous
Not applicable

rbahar006_0-1644393002908.png

I need to show 66% (268554/405769) instead of 268554. If I chose show value as percentage from grand total it gives the result of (268554/329753)

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.