Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (11.1k points)
recategorized by

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'),
AND([Date]>=DATEADD('Count'[Date],-6,DAY)&&[Date]<=EARLIER([Date]),[ID]=EARLIER('Count'[ID]))),ID]) 
return
if(freqcount>=4,"Daily",if(freqcount>=2,"Weekly",if(freqcount>=1,"First time","Inactive")))

1 Answer

0 votes
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.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Mar 28, 2021 in BI by Chris (11.1k points)
0 votes
1 answer
0 votes
1 answer
asked Mar 28, 2021 in BI by Chris (11.1k points)

31k questions

32.4k answers

500 comments

693 users

Browse Categories

...