Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Determining How Many Days Since Last error

Hi Everyone,   I have below columns 1.Source,  2. This week Num of days without errors & Week of year column column. i want number of days without error. In Below column for source CFDI all fives...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    I updated my sample pbix file(see attachment), please check whether that is what you want.

    Measure =
    VAR _week =
    CALCULATE (
    MAX ( 'Table'[Week of Year] ),
    FILTER (
    'Table',
    'Table'[Source] = SELECTEDVALUE ( 'Table'[Source] )
    &&'Table'[Year]=SELECTEDVALUE('Table'[Year])
    && 'Table'[Days of week] < 5
    )
    )
    VAR _days =
    CALCULATE ( SUM ( 'Table'[Days of week] ) )
    VAR _days1 =
    CALCULATE (
    SUM ( 'Table'[Days of week] ),
    FILTER (
    'Table',
    'Table'[Source] = SELECTEDVALUE ( 'Table'[Source] )
    &&'Table'[Year]=SELECTEDVALUE('Table'[Year])
    && 'Table'[Week of Year]
    >= _week
    )
    )
    RETURN
    IF ( ISBLANK ( _week ), _days, _days1 )

     

    Measure 2 = SUMX(VALUES('Table'[Source]),SUMX(VALUES('Table'[Year]),[Measure]))

    Best Regards