2 views
in BI
recategorized

In power bi, I am trying to build a formula for frequency encounter

I am trying to add IF Statement to the formula, which is the calculated column "Time frame" which shows the duration of the item in minutes.

The formula should be run only when the  "Time frame" is equal or bigger than 1

The formula is:

```Calculated column =
Var freqcount =
COUNTAX(FILTER(ALL('Count'),
return
if(freqcount>=4,"Daily",if(freqcount>=2,"Weekly",if(freqcount>=1,"First time","Inactive")))```

by (22.5k points)

It becomes easier when you use formula

```Calculated column =
var rDate = yourTable[Date]
var rID = yourTable[ID]
var freqCount = CALCULATE(yourTable('Count'), FILTER(yourTable, rDate >= DATEADD(yourTable[Date], -6 , DAY) && rID = yourTable[ID] && yourTable['Time frame'] > 0))
return if(freqcount>=4,"Daily",if(freqcount>=2,"Weekly",if(freqcount>=1,"First time","Inactive"))) ```

If you want to learn more about Power BI, then enroll in our Power BI Training to become proficient in this BI tool.