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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Nawalasim8
Regular Visitor

matrix not showing correct dates with custom date range (last x days etc)

Hello, i have a date selector that works as seen in the post here: (13) Custom Range Date Slicer in Power BI with dynamic defaults and more... | LinkedIn

its filtering all my bar charts correctly and showing only relevant data, however when it comes to matrix visuals where i have data displayed over months, its showing me incorrect values when the last x is selected. See below: (once custom date range is selected, its showing correct data) 

Nawalasim8_0-1742809782744.png

(selection for context)
 matrix:

Nawalasim8_1-1742809814403.png

however once i have this selection:

Nawalasim8_2-1742809872932.png

it shows me all the months of the previous custom selection but with no data and only shows relvant (last 7 days of data) populated:

Nawalasim8_3-1742809921976.png


This is probably because the previous selection is causing some filtering issues, but Im not sure how exactly to resolve this, since this problem isnt coming up for the month wise bar charts. 


Any help would be appreciated, Thanks!




4 REPLIES 4
v-sathmakuri
Community Support
Community Support

Hi @Nawalasim8 ,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please accept it as a solution and give it a 'Kudos' so other community members with similar problems can find a solution faster.

Thank you.

v-sathmakuri
Community Support
Community Support

Hi @Nawalasim8 ,

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. If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

v-priyankata
Community Support
Community Support

Hi @Nawalasim8 

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-priyankata
Community Support
Community Support

Hi @Nawalasim8,
Can you please try below DAX 

SpecialDates =

 

VAR _datetable = DateTable
VAR today = TODAY()
VAR month = MONTH(TODAY())
VAR year = YEAR(TODAY())
VAR _thismonthstart = DATE(year,month,1)
VAR _thisyearstart = DATE(year,1,1)
VAR _lastmonthstart = EDATE(_thismonthstart,-1)
VAR _lastmonthend = _thismonthstart-1  
VAR _thisquarterstart = DATE(YEAR(today),SWITCH(true,month>9,10,month>6,7,month>3,4,1),1)

 

RETURN UNION(

 

    ADDCOLUMNS(FILTER(_datetable,[Date]=today),"Period","Today","Order",1),
    ADDCOLUMNS(FILTER(_datetable,[Date]=today-1),"Period","Yesterday","Order",2),
    ADDCOLUMNS(FILTER(_datetable,[Date]>today-7),"Period","Last 7 Days","Order",3),
    ADDCOLUMNS(FILTER(_datetable,[Date]>=_thismonthstart),"Period","This Month","Order",4),
    ADDCOLUMNS(FILTER(_datetable,[Date]>=_thisquarterstart),"Period","This Quarter","Order",5),
    ADDCOLUMNS(FILTER(_datetable,[Date]>=_thisyearstart),"Period","This Year","Order",6),
    ADDCOLUMNS(FILTER(_datetable,[Date]>today-30),"Period","Last 30 Days","Order",7),
    ADDCOLUMNS(_datetable,"Period","Custom...","Order",8)

 

    )



If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

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.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors