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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Applied Slicer to unrelated tables

I have four tables, two table (RiskTable, and CompanyTable) were related but inactive relationship. These inactive relationship table is used as a slicer to filter the other table. However, it is not working when i filter it. 
I used the dax measure 

prev month = 
VAR current = Max(Date[RelativePeriod])
VAR prev = current - 1
VAR prePerformance = CALCULATE(MAX(RiskTable[Performance), ALLEXCEPT(RiskTable,RiskTable[Company], RiskTable[Direct]), Date[RelativePeriod] = prev)
RETURN
IF (ISBLANK(prePerformance), "ND", prePerformance)

 Because CompanyTable is inactive relation with RiskTable by Company[Company] and RiskTable[Company], i not getting the right output.
Company in CompanyTable is the slicer. How can i rewrite the dax to fit in CompanyTable[Company] in the above dax

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , You can use treatas

https://www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/

 

example


CALCULATE(MAX(RiskTable[Performance), ALLEXCEPT(RiskTable,RiskTable[Company], RiskTable[Direct]), Date[RelativePeriod] = prev, filter(RiskTable, RiskTable[Company] in allselected(Company[Company] )))

 

also prefer to use TI and date table

 

Power BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA


To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Anonymous
Not applicable

@amitchandak - it is not working. When i applied the additional filter expression, it return ND whereas it show retun the value

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.