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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Display the result of friday as yesterday for monday

Hello Community,

 

I have a measure which calculate the count of insepection for yesterdaty based on today's date: 

Number of UD taken Yesterday =
CALCULATE (
DISTINCTCOUNT('INSPECTION LOTS DATA - Header'[Inspection lot])) ,
ALL ( 'INSPECTION LOTS DATA - Header'[UD Code] ),
USERELATIONSHIP ( 'DIM_Calendar'[Date], 'INSPECTION LOTS DATA - Header'[UD code date] ),
'DIM_Calendar'[Date] =TODAY()-1),
'INSPECTION LOTS DATA - Header'[UD Code] <> BLANK ()
)
 
But since I don't have Data saturday and sunday, i want to display the data of friday as yesterday of monday 
 
Could you help me please ?
 
Thanks
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understand correctly about your data model and your calendar table, but please try to write a measure something like below, for inserting a condition that is not including saturday and sunday.

 

Number of UD taken Yesterday =
VAR _today =
    TODAY ()
VAR _yesterdayexceptweekends =
    MAXX (
        FILTER (
            'DIM_Calendar',
            'DIM_Calendar'[Date] < _today
                && 'DIM_Calendar'[Weekdayname] <> "Saturday"
                && 'DIM_Calendar'[Weekdayname] <> "Sunday"
        ),
        'DIM_Calendar'[Date]
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'INSPECTION LOTS DATA - Header'[Inspection lot] ),
        ALL ( 'INSPECTION LOTS DATA - Header'[UD Code] ),
        USERELATIONSHIP ( 'DIM_Calendar'[Date], 'INSPECTION LOTS DATA - Header'[UD code date] ),
        'DIM_Calendar'[Date] = _yesterdayexceptweekends,
        'INSPECTION LOTS DATA - Header'[UD Code] <> BLANK ()
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Thank you for you help 🙂

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understand correctly about your data model and your calendar table, but please try to write a measure something like below, for inserting a condition that is not including saturday and sunday.

 

Number of UD taken Yesterday =
VAR _today =
    TODAY ()
VAR _yesterdayexceptweekends =
    MAXX (
        FILTER (
            'DIM_Calendar',
            'DIM_Calendar'[Date] < _today
                && 'DIM_Calendar'[Weekdayname] <> "Saturday"
                && 'DIM_Calendar'[Weekdayname] <> "Sunday"
        ),
        'DIM_Calendar'[Date]
    )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'INSPECTION LOTS DATA - Header'[Inspection lot] ),
        ALL ( 'INSPECTION LOTS DATA - Header'[UD Code] ),
        USERELATIONSHIP ( 'DIM_Calendar'[Date], 'INSPECTION LOTS DATA - Header'[UD code date] ),
        'DIM_Calendar'[Date] = _yesterdayexceptweekends,
        'INSPECTION LOTS DATA - Header'[UD Code] <> BLANK ()
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.