Forum Discussion
raj111983
1 year agoFrequent Visitor
Help with Intersect Function
HI, I just new to Power BI and having difficult time in using Intersect function. Basically I have a single Sales table with multi year data. I created an unrelated Dates table from the Sales table ...
- Anonymous1 year ago
Hi raj111983 ,
I updated your sample pbix file(see the attachment), please check if that is what you want.
Chart PTran = VAR _selyear = SELECTEDVALUE ( 'Dates'[Date].[Year] ) VAR _prevyear = SELECTEDVALUE ( 'Dates'[Date].[Year] ) - 1 VAR _month = SELECTEDVALUE ( 'Sales'[Date].[Month] ) VAR _CSource = CALCULATETABLE ( VALUES ( 'Sales'[Source ID] ), FILTER ( ALLSELECTED ( 'Sales' ), 'Sales'[Date].[Year] = _selyear ) ) VAR _PSource = CALCULATETABLE ( VALUES ( 'Sales'[Source ID] ), FILTER ( ALLSELECTED ( 'Sales' ), 'Sales'[Date].[Year] = _prevyear ) ) VAR _tab = INTERSECT ( _CSource, _PSource ) RETURN CALCULATE ( SUM ( Sales[Measure Value] ), FILTER ( 'Sales', 'Sales'[Date].[Year] = _prevyear && 'Sales'[Date].[Month] = _month && 'Sales'[Measure Name] = "Volume" && 'Sales'[Source ID] IN _tab ) )Best Regards
raj111983
1 year agoFrequent Visitor
Hi,
Sample data is in Drop Box folder. Please le tme know if you can access it.
As you can see the data, Source ID AHA is present in 2024 so that shouldnt be included in the chart for current or previous year. Same with Source ID FKA, data is not availabel for Jan2023 so it shouldnt be included in Jan2024 sum. This is to Apples-Apples comparisionby Source ID and Month. I want to show full year last year and current year. But when I use intersect function, its only showing the data till Septemper.
Thank you!!
raj111983
1 year agoFrequent Visitor
Hi,
Here is the pbix with sample data. I wanted the previous year