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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Slicer to Update on Two Table using M Query

I have been having this trouble which I need to filter two tables before joining it into one table. This filtering needed has to be selected by user. I've been stumbled upon Dynamic M Query and I think this is my best solution. Would appreciate if anyone can help me building this feature (as I am not familiar and still learning using M Language). 

 

I have these two table as below:

 

Aziz_Arrashid_0-1638330657003.png

Aziz_Arrashid_1-1638330677506.png

 

I need to combine these two table.

Before combining user have to select which PRODUCT TYPE they need to view (FMC or NC)

After that, the second filter that user will have to select is the month. Let say user select MONTH 7, Table 1 will show rows from MONTH 1 until 6 and from Table 2 will display MONTH 7 until 12.  And let say user select MONTH 9, Table 1 will show rows from MONTH 1 until 8 and from Table 2 will display MONTH 9 until 12. 

 

Would appreciate if someone can help me with this. 

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

The M queries are not affected by user interactions (although they can be parameterized...).

 

I'd recommend appending these tables, defining a parameter table for the months to use in a slicer, and a measure that switches from returning actual to forecast based on the month selected by the slicer. E.g.

SwitchMeasure =
VAR SelectedMonth = SELECTEDVALUE ( param[Month] )
RETURN
    CALCULATE (
        [measure1],
        Table1[Actual/Forcast] = "ACT",
        Table1[Month] < SelectedMonth
    )
        + CALCULATE (
            [measure1],
            Table1[Actual/Forcast] = "FC",
            Table1[Month] >= SelectedMonth
        )

where [measure1] is whatever metric you're interested in computing like SUM ( Table1[Sales] ) or whatever.

View solution in original post

1 REPLY 1
AlexisOlson
Super User
Super User

The M queries are not affected by user interactions (although they can be parameterized...).

 

I'd recommend appending these tables, defining a parameter table for the months to use in a slicer, and a measure that switches from returning actual to forecast based on the month selected by the slicer. E.g.

SwitchMeasure =
VAR SelectedMonth = SELECTEDVALUE ( param[Month] )
RETURN
    CALCULATE (
        [measure1],
        Table1[Actual/Forcast] = "ACT",
        Table1[Month] < SelectedMonth
    )
        + CALCULATE (
            [measure1],
            Table1[Actual/Forcast] = "FC",
            Table1[Month] >= SelectedMonth
        )

where [measure1] is whatever metric you're interested in computing like SUM ( Table1[Sales] ) or whatever.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.