Forum Discussion

saqibahmad's avatar
saqibahmad
Frequent Visitor
8 years ago

How to modify data across tables , trying to replicate macro functioality

 

I am converting an excel report having macro which modifies data/formula in daily worksheet based on values in Events table as below. Any idea how can i achieve this in DAX or ?

I have data in two tables as

Events table:

start dt, end date, span-days

3/01/20184/01/20181
4/01/20189/01/20185
9/01/20189/01/20180
9/01/20189/01/20180
9/01/20189/01/20180
9/01/20189/01/20180

 

Dailytable: start dt, end dt and idle-hours

5/01/20186/01/2018 
6/01/20187/01/2018 
7/01/20188/01/2018 
8/01/20189/01/2018 

 

data in daily table has uniqe dates where in events table it is not.

 

I want to calculate daily. idel-hours based on events.span-days value such that 

if  span-days>2 then

       loop unitl span-days starting with value of 2 say x

               dailytable.startdate+x.idle-hrs= .idle-hrs*60

  end

this would create an entry of say 60 in idle-hours for each row in daily table.

How can I achieve this in PowerBI?

Can I create a table using any script or how can access individual row ?

 

 

1 Reply

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi saqibahmad,

     

    You could have a reference of this similar thread which has been solved.

     

    If you still need help, please share your expected output.

     

    Best Regards,

    Cherry