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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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