lundi 20 juillet 2020

Power BI first IF-Statement then the DAX-Formula

I am new to Power BI and have the following issue:

I tried to build a formula for a frequency counter. I got some examples from the web and I was able to build this working formula. The basic idea behind is to categorize an item with the values: daily, weekly or first time.

I tried to add an IF-Statement to the formula, that is checking a calculated column "Time frame", which shows the duration of an item in minutes.

Basically it should run this formula only if the Column "Time frame" is equal or bigger 1.

Now the formula gives to items with a Time frame of 0, the value first time. But they should be ignored or blanked.

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")))

I would be thankful, if someone could support me with this issue.

Aucun commentaire:

Enregistrer un commentaire