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
jsdrolias
Regular Visitor

How to calculate different payment methods of supplier and use it in visualizations

Dear all,

 

consider the following data model:

 


Screen Shot 06-26-18 at 09.44 AM.PNG

 

And the following test data:

 

 

Screen Shot 06-26-18 at 09.47 AM.PNG

 

 

I would like to visualize the comparison of the different payment methods used by each supplier.

For example 

 

if slicers have no value,

supplier A have used Cheque,Cash and Voucher (3 payment methods)

supplier B have used Cheque and Voucher (2 payment methods)

Therefore a pie chart should have a legend of 2 and 3 with 50% each (because there is one supplier in each different payment method count)

 

if shopA is selected on slicer

supplier A have used Cheque and Voucher (2 payment methods)

supplier B have used Voucher (1 payment methods

Therefore a pie chart should have a legend of 2 and 1 with 50% each (because there is one supplier in each different payment method count)

 

pbix link : 

https://drive.google.com/file/d/1n3A2FXGdMIvXTwHX_0zEFF8vTrDh3E6e/view?usp=sharing

 

Can you please help me how to accomplish this?

 

I have tried a number of things which failed.

For example, if a make a measure on supplier and use distinct count of payment methods, it is computed correctly but cannot use measure as legend on a pie chart.

 

Any help will be appreciated!

 

Kind regards,

Ioannis

 

 

 

 

 

1 ACCEPTED SOLUTION

I did manage to get it to work after all.

 

A table having initial values of different payment methods is created as 

 

DiffP = SELECTCOLUMNS(CALENDAR(DATE(1899,12,31),DATE(1900,1,26)),"DiffPayTerms",int([Date]))

 

Then a measure that counts the suppliers of these different payments methods.

 

mDiffPTeerms =
IF(
COUNTROWS(
FILTER(SUMMARIZE(Purchases,Purchases[supplierID],"diffPTermsCalc",DISTINCTCOUNT(Purchases[payMethodID])),max(DiffP[DiffPayTerms])=[diffPTermsCalc])
) > 0 ,
COUNTROWS(FILTER(SUMMARIZE(Purchases,Purchases[supplierID],"diffPTermsCalc",DISTINCTCOUNT(Purchases[payMethodID])),max(DiffP[DiffPayTerms])=[diffPTermsCalc])),
BLANK())

 

if a value of different payment terms does not match the calculation from the data table, blank is returned.

 

In this fashion, a pie chart can be constructed as 

 

Screen Shot 06-26-18 at 05.23 PM.PNG

 

where it is depicted as 1 supplier exists having 3 different payment methodsand 1 supplier exists having 2 different payment methods.

View solution in original post

3 REPLIES 3
Barnee
Advocate IV
Advocate IV

Hi @jsdrolias

so if I understood correctly you want to count the purchases and differentiate it by suppliers and payment methods then put it on to a visual, correct?

If so I made this pie chart and as far as I see you don't really have to make measures to visualise this problem.
The supplierDesc will provide the color legend and the payMethodDesc will provide the other.  then I counted the purchesID-s as values of the chart.

pie.PNG

Please tell me if it is what you wanted to achieve, and if not please ellaborate more your goal.

 

Bests,

Barna

hi @Barnee,

thank you for the post.

 

This is not exactly what I want to achieve.

 

I am not insterested in showing the particular payment methods rather than the different distinct payments methods used.

 

Therefore, the areas in a pie chart should be e.g. 1,2,3,4,5 depending on the different payments methods.

 

In simple words,

 

I want to be depicted that e.g.

33.33% of the supplier have used 1 payment method(only cash for example),

33.33% have used 2 payment methods(e.g. cash and vouchers) and

33.33% have used 3 payment methods (cash, vouchers,cheques).

 

I am not interested in showing the particular payment methods.

In this way, if a supplier has used cash and cheques and another supplier has used cash and vouchers, both cases count as a supplier having used 2 payment methods.

 

The only metrics of interest is the different payment methods and the percentage of suppliers using these distinct payment methods count.

 

Kind regards,

Ioannis

 

I did manage to get it to work after all.

 

A table having initial values of different payment methods is created as 

 

DiffP = SELECTCOLUMNS(CALENDAR(DATE(1899,12,31),DATE(1900,1,26)),"DiffPayTerms",int([Date]))

 

Then a measure that counts the suppliers of these different payments methods.

 

mDiffPTeerms =
IF(
COUNTROWS(
FILTER(SUMMARIZE(Purchases,Purchases[supplierID],"diffPTermsCalc",DISTINCTCOUNT(Purchases[payMethodID])),max(DiffP[DiffPayTerms])=[diffPTermsCalc])
) > 0 ,
COUNTROWS(FILTER(SUMMARIZE(Purchases,Purchases[supplierID],"diffPTermsCalc",DISTINCTCOUNT(Purchases[payMethodID])),max(DiffP[DiffPayTerms])=[diffPTermsCalc])),
BLANK())

 

if a value of different payment terms does not match the calculation from the data table, blank is returned.

 

In this fashion, a pie chart can be constructed as 

 

Screen Shot 06-26-18 at 05.23 PM.PNG

 

where it is depicted as 1 supplier exists having 3 different payment methodsand 1 supplier exists having 2 different payment methods.

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.