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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Jyaul1122
Helper II
Helper II

Dates based on Slicer selection

Hi,

I have two tables Fact and Date table, both are link many to one with Fact(data_date) and Date table(Dates).

Fact Table:

ProjectData_DateActual Date
Project15/22/202511/19/2030
Project15/29/202512/18/2030
Project16/5/20251/16/2031
Project16/12/20252/14/2031
Project25/22/20253/1/2031
Project25/29/20253/16/2031
Project26/5/20253/31/2031
Project26/12/20254/15/2031
Project36/19/20255/5/2032
Project36/26/20255/6/2032

 

Dates Table:

Dates
5/22/2025
5/29/2025
6/5/2025
6/12/2025
6/19/2025
6/26/2025
7/3/2040
7/5/2042
7/6/2042
7/7/2042
7/8/2042

 

I have slicer from Fact table(Data_date)-single select, I would like to display Actual Date  from Fact table where Fact(Data_Date)<=max(Data_Date) in matrix. Value(Actual Date) will be change based on Dates slicer.

 

For example if date selected=6/12/2025 then output will be upto data_date 6/12/2025:

  Dates(Date table) 
Project5/22/20255/29/20256/5/20256/12/2025
Project111/19/203012/18/20301/16/20312/14/2031
Project23/1/20313/16/20313/31/20314/15/2031

 

if date selected=6/19/2025 then output will be upto data_date 6/19/2025:

  Dates(Date table)  
Project5/22/20255/29/20256/5/20256/12/20256/19/2025
Project111/19/203012/18/20301/16/20312/14/2031 
Project23/1/20313/16/20313/31/20314/15/2031 
Project3    5/5/2032

, how can i achive using DAX ?

1 ACCEPTED SOLUTION
v-sshirivolu
Community Support
Community Support

Hi @Jyaul1122 ,
Thank you for reaching out to Microsoft Fabric community.

I got this working and thought I’d share how I did it,
I generated a separate slicer table from Fact[Data_Date] by creating a calculated table as shown below:
Slicer_Date = DISTINCT(Fact[Data_Date])

There’s no relationship between this table and any other — it’s just used for the slicer.

Then I created a measure to check if each date in the matrix should be shown, based on the slicer selection:

Show Column = VAR SelectedDate = SELECTEDVALUE(Slicer_Date[Data_Date])
VAR ThisColumnDate = SELECTEDVALUE(Dates[Dates])
RETURN
IF (
    NOT ISBLANK(SelectedDate) &&
    NOT ISBLANK(ThisColumnDate) &&
    ThisColumnDate,
    1,
    0
     )

 

And finally, this is the measure I used to get the actual date values in the matrix:

Selected Actual Date =

VAR SelectedDate = SELECTEDVALUE(Slicer_Date[Data_Date])
VAR ThisDate = SELECTEDVALUE(Dates[Dates])
VAR ThisProject = SELECTEDVALUE(Fact[Project])

RETURN
IF (
    NOT ISBLANK(SelectedDate) &&
    NOT ISBLANK(ThisDate) &&
    NOT ISBLANK(ThisProject) &&
    ThisDate <= SelectedDate,
    CALCULATE (
        MAX(Fact[Actual Date]),
        FILTER (
            Fact,
            Fact[Project] = ThisProject &&
            Fact[Data_Date] = ThisDate
        )
    )
)

 

In the matrix, I placed Dates[Dates] on the rows, Fact[Project] on the columns, and used the Selected Actual Date measure as the value. I also applied Show Column as a visual-level filter, setting it to 1 so that only columns on or before the selected date are displayed.

The slicer uses the Slicer_Date table we set up initially.

Everything is functioning as intended the matrix updates according to the selected date and displays only the relevant values up to that point.

Please find the attached .pbix file for your reference

Regards,
Sreeteja.

View solution in original post

11 REPLIES 11
v-sshirivolu
Community Support
Community Support

Hi @Jyaul1122 ,
Thank you for reaching out to Microsoft Fabric community.

I got this working and thought I’d share how I did it,
I generated a separate slicer table from Fact[Data_Date] by creating a calculated table as shown below:
Slicer_Date = DISTINCT(Fact[Data_Date])

There’s no relationship between this table and any other — it’s just used for the slicer.

Then I created a measure to check if each date in the matrix should be shown, based on the slicer selection:

Show Column = VAR SelectedDate = SELECTEDVALUE(Slicer_Date[Data_Date])
VAR ThisColumnDate = SELECTEDVALUE(Dates[Dates])
RETURN
IF (
    NOT ISBLANK(SelectedDate) &&
    NOT ISBLANK(ThisColumnDate) &&
    ThisColumnDate,
    1,
    0
     )

 

And finally, this is the measure I used to get the actual date values in the matrix:

Selected Actual Date =

VAR SelectedDate = SELECTEDVALUE(Slicer_Date[Data_Date])
VAR ThisDate = SELECTEDVALUE(Dates[Dates])
VAR ThisProject = SELECTEDVALUE(Fact[Project])

RETURN
IF (
    NOT ISBLANK(SelectedDate) &&
    NOT ISBLANK(ThisDate) &&
    NOT ISBLANK(ThisProject) &&
    ThisDate <= SelectedDate,
    CALCULATE (
        MAX(Fact[Actual Date]),
        FILTER (
            Fact,
            Fact[Project] = ThisProject &&
            Fact[Data_Date] = ThisDate
        )
    )
)

 

In the matrix, I placed Dates[Dates] on the rows, Fact[Project] on the columns, and used the Selected Actual Date measure as the value. I also applied Show Column as a visual-level filter, setting it to 1 so that only columns on or before the selected date are displayed.

The slicer uses the Slicer_Date table we set up initially.

Everything is functioning as intended the matrix updates according to the selected date and displays only the relevant values up to that point.

Please find the attached .pbix file for your reference

Regards,
Sreeteja.

Hi @Jyaul1122 ,
I hope the information provided above assists you in resolving the issue. If you have any additional questions or concerns, please do not hesitate to contact us. We are here to support you and will be happy to help with any further assistance you may need.

Hi @Jyaul1122 ,

I hope the above details help you fix the issue. If you still have any questions or need more help, feel free to reach out. We’re always here to support you

 

Hi @Jyaul1122 ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions

Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1752459074364.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@Ashish_Mathur 

Thanks for the reply, but I have slicer from the Fact table[Data_Date], Please do needful .Thanks

You are welcome.  That is not a good practise.  You must always create a Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
FBergamaschi
Solution Sage
Solution Sage

Hoping you repost it in the right place, here is my solution (please before accepting it as a solution in case, repost cancel the post from here and repost it in the right secttion, I shall reanswer there)

 

Image.png

 

In the above slicer you have the date column form your date table (that I strongly suggest you create in a complete fashion, you should never have a date table with incomplete years, you only see the dates in which there a rows in the fact table as I injected a filter in the slicer visual for the measure 

 

Nr Rows = CONTROWS (Fact) and forced it to be non blank

 

In the above table visual you have the columns from your fact table and the following measure in DAX

 

Selection =
VAR MaxDate = SELECTEDVALUE( 'Date'[Date] )
VAR FactDateUpTOMaxDate =
CALCULATETABLE(
    'Fact',
    REMOVEFILTERS( 'Date' ),
    'Fact'[Data_Date] <= MaxDate
)
RETURN
    COUNTROWS(
       
    FactDateUpTOMaxDate)
 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

@FBergamaschi  thanks for your reply but my expecated result will be like in Matrix:
 if date selected=6/12/2025 then output will be upto data_date 6/12/2025:

Jyaul1122_0-1752407631005.png

 

if date selected=6/19/2025 then output will be upto data_date 6/19/2025:

Jyaul1122_1-1752407652933.png

 

Column in Matrix coming from Dates table.

 

Could you please do needful ?

 

 

I do not understand, what is this forst row in color? Maybe you need to explain more in detail what you are looking for. In my result, I see dates up to the selected one as you asked, now I do not understand the tables you show, it seems an excel table in which you select in a single cell what you want to see, this is impossible in Power BI

 

best

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors