Forum Discussion

suvechha's avatar
suvechha
Helper IV
4 years ago

How to get the additional fields in table depending on variable ?

Hi All ,

I am transforming Qliksense App to Power Bi App.

Can anyone please help how to approach - I have to create a variable -  vTMP_Max_Date

 

MaxDate:
Load Max(_Date) as _MaxDate
Resident PH;

 

LET vTMP_Max_Date = Num(Peek('_MaxDate', 0, 'MaxDate'));

 

After creating the variable vTMP_Max_Date 

 

I need to add the following field in the current table which is created by evaluating the variable vTMP_Max_Date 

 

Join(PH)
load distinct _Date,
Interval($(vTMP_Max_Date) - _Date,'d') As PH.Last_n_days,
if(Interval($(vTMP_Max_Date) - _Date,'d') =0,1,0) as PH.count_today,
if(Interval($(vTMP_Max_Date) - _Date,'d') =7,1,0) as PH.count_7_days_ago
resident PH
;

 

Currently I have the PH table with below columns

 

I want to get the columns

PH.Last_n_days,

PH.count_today,
PH.count_7_days_ago like below

 

1 Reply