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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

DIsplay data from previous date depends on slicer

Dear friends

how can i let data always display as date-1 depends on selected date on slicer for example

 

DateProduct
01-01-21A
01-01-21A
01-01-21A
02-01-21B
02-01-21B
03-01-21A

how can i count product "B" on date 2 -1-21 but slicer selected on 3-1-21

thanks you in advance for any suggestion

1 ACCEPTED SOLUTION
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

Try follow steps:

1.create calaulated  table "calendar"

Calendar = CALENDARAUTO()

2.create measure as below:

CountB = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        'Table',
        'Table'[Product] = "B"
            && 'Table'[Date]
                = CALCULATE (
                    MAX ( 'Table'[Date] ),
                    FILTER ( 'Table', 'Table'[Date] < SELECTEDVALUE ( 'Calendar'[Date] ) )
                )
    )
)

25.png

 

Please check my sample pnbix file for more details.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
v-easonf-msft
Community Support
Community Support

Hi , @Anonymous 

Try follow steps:

1.create calaulated  table "calendar"

Calendar = CALENDARAUTO()

2.create measure as below:

CountB = 
CALCULATE (
    COUNTROWS ( 'Table' ),
    FILTER (
        'Table',
        'Table'[Product] = "B"
            && 'Table'[Date]
                = CALCULATE (
                    MAX ( 'Table'[Date] ),
                    FILTER ( 'Table', 'Table'[Date] < SELECTEDVALUE ( 'Calendar'[Date] ) )
                )
    )
)

25.png

 

Please check my sample pnbix file for more details.

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-easonf-msft I have tried this but measure show as blank , are u have any suggestion : (

 

moscholes_0-1616559949341.png

 

Hi, @Anonymous 

Have you check the relationship between tables?

In my demo, there is no relationship between the Calendar table and the Data table.

 

Best Regards,
Community Support Team _ Eason

 

Anonymous
Not applicable

@v-easonf-msft i will try to switch off relationship

Anonymous
Not applicable

@v-easonf-msft Thank you so much!

amitchandak
Super User
Super User

@Anonymous , with help from date table and time intelligence

 

example

 

This Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])))
Last Day = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Date]=max('Date'[Date])-1))
Last Day = CALCULATE(sum('order'[Qty]), previousday('Date'[Date]))

 

 

Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c3243d1f9

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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
Top Kudoed Authors