Skip to content
Advertisement

Power BI DAX – find repeatability

Given data as such:

Is there a way to make a measure that would find if for each month, last three Values were True? So the output would be (F,F,T,F)? That would propably mean that my actual problem is solvable, which is finding from:

the count of those booleans for each row, so the output would be (0,0,2[A and C],1[B])

EDIT: Okay, I managed to solve the first part with this:

But is there a way to use it with unknown number of columns? Without hard – coding every column name? Like a loop or something.

Advertisement

Answer

I would redo the data table in power query (upivoting the ValueX-columns) and changing T/F to 1/0. Then have a dim table with a relationship to Month, like this: enter image description here enter image description here Then add a measure like this:

Then I can have a visual like this when the slicer indicates which time window I’m looking at and the table shows if there has been 3 consecutive Ts or not.

enter image description here

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement