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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Arpansingh28
Regular Visitor

Show from current to N month data in powerbi

Hi,

i have 3  powerbi tables

tables(a,b,c),

b table is connected with others(a,c)

and b have a date column which will be used to filter visuals(matrix) created from a and c tables......

these tables have data from nov 2022 to march2026.

1. I will only want to give user option of 12 month in filter, from current(1st month) to next 11 months data

2. rather than using b table date column directly as filter, I want to use Number of month(for example current month june 2023 is number 1, august 2023 is no 3)

3. if i select number 1 then show only current month data in both a and c , if for example number 5 then ,all current+4 months data

data is not sales dats so can't use aggregate functions 

 

 

2 REPLIES 2
Martin_D
Super User
Super User

Is this DAX table what you are looking for?

Calendar = 
VAR _Today = TODAY()
VAR _Dates =
    CALENDAR ( 
        DATE ( 2022, 11,  1),
        DATE ( 2026,  3, 31 )
    )
VAR _RelativeMonth =
    ADDCOLUMNS (
        _Dates,
        "Rel. Month",
        VAR _RowDate = [Date]
        RETURN
        DATEDIFF ( _Today, _RowDate, MONTH )
    )
RETURN
_RelativeMonth

If you want the date column to be in date datatype instead of datetime datetype you can change it in the Column Tools. The DAX code can only generate datetime values.

 

Sahir_Maharaj
Super User
Super User

Hello @Arpansingh28, can you please try: 

 

1. Create a new calculated column in the 'b' table that calculates the "Number of month" based on the date column.

Month Number = DATEDIFF(MIN('b'[Date]), 'b'[Date], MONTH) + 1

2. Create a measure in both the 'a' and 'c' tables to filter the data based on the selected "Number of month.

Month Filter =
VAR SelectedMonth = SELECTEDVALUE('b'[Month Number])
RETURN
    IF(
        ISBLANK(SelectedMonth) || [Month Number] <= SelectedMonth,
        <your existing measure calculation>,
        BLANK()
    )

3. Apply the "Month Filter" measure as a filter in the visuals (matrix) created from tables 'a' and 'c'. Set the filter to include only the values where the "Month Filter" measure is not blank.

 

Do not hesitate to let me know if you might need further assistance.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.