Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Calculating the no. tripled values within 12 weeks

Hello I am currently investigating a dataset that contains the following columns below. The table refers to a series of assets that appear in a dataset if they have been verified to have failed ...
  • v-kelly-msft's avatar
    6 years ago

    Hi Anonymous ,

     

    Create 2 measures as below:

     

     

    Measure = 
    var _totalrows=CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Asset ID]=MAX('Table'[Asset ID])))
    var _mindate=MINX(FILTER(ALL('Table'),'Table'[Asset ID]=MAX('Table'[Asset ID])&&'Table'[Date of entry]<MAX('Table'[Date of entry])),'Table'[Date of entry])
    var c=DATEDIFF(_mindate,MAX('Table'[Date of entry]),WEEK)
    Return
     IF(_totalrows>=3 && c<12,"repeat error",BLANK())
    Repeat error = 
    var a =CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Asset ID]=MAX('Table'[Asset ID])))
    var b=CALCULATE(COUNTROWS('Table'),FILTER(ALL('Table'),'Table'[Asset ID]=MAX('Table'[Asset ID])&&'Table'[Measure]<>BLANK()))
    var c=IF(a>=3&&a-b<2,1,0) Return
    SUMX(FILTER(ALL('Table'),'Table'[Asset ID]=MAX('Table'[Asset ID])),c)

     

     

    Finally you will see:

    For the related .pbix file,pls click here.

     

     
    Best Regards,
    Kelly
    Did I answer your question? Mark my post as a solution!