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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Filtering the Bar chart containing Use relationship Measure - Not filtering data correctly

Hi Team,

 

I have a model in which there is one data table that contains invoice date and payment date. The active relationship is invoice date. I have created a measure called as Payment date as: 

Payment by Payment Date = CALCULATE(SUM(Main[PaymentAmount]),USERELATIONSHIP(Dates[Date],Main[PaymentDate]))
With that I have created the bar chart for Payment by month and there is a bar chart with Invoice with month. The data shown in the barchart seems to be correct. But, when I click the one of the month in the Payment barchart it is not filtering the table as I think it supposed to. It is filtering as if I am clicking on Invoice date (being the main active relation). One payment can have multiple Invoices. So when I click Payment month then it should split the invoice months and vice versa but it is only showing one month. Also, when clicking the payment amount apr 2017 (2.0M) the table is fitlering by Invoice month (9M) which should only  those records summing to 2 M.Hope it makes sense. 
I will attach some pictures and let me know if it is a bug or I am doing something wrong. 
First Look - Invoice and Payment togetherFirst Look - Invoice and Payment together
Clicking Invoice month- Only filtering Payment for that monthClicking Invoice month- Only filtering Payment for that month
 
Click Payment month - Only filtering Invoice for that monthClick Payment month - Only filtering Invoice for that month
Clicking Invoice Month - Table filtered by Invoiced month (Check amount)Clicking Invoice Month - Table filtered by Invoiced month (Check amount)
ModelModel
 
Status: New
Comments
v-lili6-msft
Community Support

HI  @Anonymous 

this is an expected behavior in power bi for your data model.

3.JPG

 

from your screenshot, all your data are in one table, and are only connect with date table, so when you click one month bar, it will only pass year-month as a filter to other visual.

 

you need to change your data model in your report, please share some simple sample data and your expected output and we could give some suggestion for your model.

 

 

Regards,

Lin

Anonymous
Not applicable

Thanks Lin for your quick reply. Please find my sample data below. 

Sample DataSample Data

 

v-lili6-msft
Community Support

hi  @Anonymous 

do not use a screenshot for sample data that will will be difficult to import into power bi on our side.

Some simple sample data and expected output would help tremendously.
Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

Anonymous
Not applicable

Sorry Lin! Thanks for the suggestion, I will keep that in mind.  Please find it below. One payment can have multiple invoices. If possible I want to be able to filter the data both by Invoice date and Payment date but the main one we are after is Invoice. Since, clicking on bar chart for the Payment did not filter the table as expected my question has emerged. 

VENDORIDVENDNAMEPaymentVoucherNoPaymentDocumentNoPaymentDateDocDate_ApplyZoomWindowInvoice Paid in DaysVoucherNumber_ApplyZoomWindowDocnumber_ApplyZoomWindowPaymentAmount
ABCABC                                          206308CB0191114     14/11/201921/10/201924707794296124932.04
ABCABC                                          206308CB0191114     14/11/201928/10/2019177077952961251725.13
ABCABC                                          206308CB019111414/11/201918/10/201927707796296126170.75
ABCABC                                          206308CB019111414/11/201923/10/201922707797296127361.64
ABCABC                                          206308CB019111414/11/201923/10/201922707798296128892.98
ABCABC                                          206308CB019111414/11/201928/10/201917707799296129752.96
ABCABC                                          206308CB019111414/11/201924/10/201921707800296130229.47
ABCABC                                          206308CB019111414/11/201930/10/20191570780129613158.05
ABCABC                                          206308CB019111414/11/201930/10/201915707802296132243.24
ABCABC                                          206308CB019111414/11/20191/11/201913707803296133109.25
ABCABC                                          206308CB019111414/11/20191/11/2019137078042961341136.21
ABCABC                                          206308CB019111414/11/201921/10/201924707805296135112.37
CDFCDF206534CB019111900   19/11/201924/10/2019267078062961361456.4
CDFCDF206534CB019111900   19/11/201918/10/201932707807296137541.2
CDFCDF206534CB01911190019/11/201918/10/201932707808296138338.8
CDFCDF206534CB01911190019/11/201923/10/201927707809296139316.8
CDFCDF206534CB01911190019/11/201931/10/2019197078102961402145
CDFCDF206534CB01911190019/11/201931/10/201919707811296141715
CDFCDF206534CB01911190019/11/201928/10/2019227078122961421485
v-lili6-msft
Community Support

HI  @Anonymous 

You may try this way as below:

add another date table and create relationship

5.JPG

 

for Dates table, when you click one of the month in the Payment barchart, it will only return that month in dates table.

 

so for below visual, please use this logic to create a measure instead of your measure

New Measure=CALCULATE(SUM(Main[PaymentAmount]),FILTER('Dates 2', 'Dates 2'[Date] in VALUES(Dates[Date])))

and use dates 2 table instead of dates table in the visual too. 

 

Regards,

Lin