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
digant
Helper I
Helper I

Date Filter on top of USERELATIONSHIP

Table RelationshipTable Relationship

 

 

 

Volumedata for newly opened AccountVolumedata for newly opened Account

TradeDateVOLUME
31/10/2017108048300.6
30/09/201787441377.16
Total 195,489,677.76 

 

Hi,

 

I have defined table relationship and volume data for newly opened account as above. I am trying to get Volume of Newly Opened Account sliced by date filters.

 

Let's say I have chosen date filter(taken from calender as Sep 2017. I can think of below way to get volume but it will show value as 195 mil as my relationship is based on contractId. How can I filter that result set so as to filter records based on trade date between selected dates ?

 

Correct answer should be 87 mil.

 

NewlyTradeVolume =
CALCULATE (
    SUM ( rpt_pbi_sales_volume[VolumeAUD] ),
    USERELATIONSHIP ( rpt_pbi_sales_acs[sfContractID], rpt_pbi_sales_volume[sfContractID] )
)

 

Thank you in advance !!

Regards

 

Digant

1 ACCEPTED SOLUTION

Hi,

 

I managed to get desired results by adding below measures.

 

Calendar table 

StartDate = CALCULATE(MIN('Calendar'[Date]), ALLSELECTED('Calendar'[Date])) 

EndDate = CALCULATE(MAX('Calendar'[Date]), ALLSELECTED('Calendar'[Date])) 

 

NewlyTradeVolume =
CALCULATE (
    SUM ( rpt_pbi_sales_volume[VolumeAUD] ),
    USERELATIONSHIP ( rpt_pbi_sales_acs[sfContractID], rpt_pbi_sales_volume[sfContractID] ),
    DATESBETWEEN ( rpt_pbi_sales_volume[TradeExecuted], [StartDate], [EndDate] )
)

 

Regards

 

Digant

 

 

View solution in original post

5 REPLIES 5

Mmmm, this doesn't look like standard dimensional modelling. 

 

Consider removing the relationships from calendar to the 2 detail tables

set the relationships between header and details tables to active 

set 1 relationship only from calendar[date] to header[date]

 

maybe I'm. It understanding your data, but that is how I would set it up assuming the lower 3 tables are header and detail



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Hi @MattAllington

 

Thank you for your reply. acs is master and volume, withdrawal are detail tables. In case, if I remove that relationship, I will not be able to display Total Volume  / Total funding(not newly traded but for all) based on date filters. 

 

Moreover, removing that relationship is not bringing correct results.

Removed relationshipsRemoved relationships

 

Regards

 

Digant

 

 

Well I don't know your data, but the original image doesn't look like good modelling to me.  Of course you will need to make it work for the data structure you have.  I don't know what acs master, volume and withdrawal details mean so I can't really help with that.



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Hi,

 

I managed to get desired results by adding below measures.

 

Calendar table 

StartDate = CALCULATE(MIN('Calendar'[Date]), ALLSELECTED('Calendar'[Date])) 

EndDate = CALCULATE(MAX('Calendar'[Date]), ALLSELECTED('Calendar'[Date])) 

 

NewlyTradeVolume =
CALCULATE (
    SUM ( rpt_pbi_sales_volume[VolumeAUD] ),
    USERELATIONSHIP ( rpt_pbi_sales_acs[sfContractID], rpt_pbi_sales_volume[sfContractID] ),
    DATESBETWEEN ( rpt_pbi_sales_volume[TradeExecuted], [StartDate], [EndDate] )
)

 

Regards

 

Digant

 

 

Hi @digant,

Have you resolved your issue? If you have, welcome to mark the right reply as answer. More people will benefit from here. If you haven't, please feel free to ask.

Thanks,
Angelia

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.