Syntax question for the DAX/SQL coders

bertusavius

Board Regular
Joined
Feb 28, 2008
Messages
82
Below is a piece of code that used to work for me.


It's use is to join two tables:
1 with time events (start/stoptime colums)
2 table withe time buckets/bins

The end result was a histogram of these time events.


After pasting it in e newer version of powerpivot, I got this error message:

"The second and third arguments of function IF have different data types. This is not supported."

highlighted in red the piece of code that also gets highlighted when the error message appears.


SUMX(
CROSSJOIN('Workforce';'Buckets');


(if(or(Workforce[Starttijd]>= ((1/24)*4);Workforce[Starttijd] > Workforce[Stoptijd]);
IF(AND(
IF(Workforce[Starttijd]<((1/24)*4);Workforce[Starttijd]+1;Workforce[Starttijd]) < IF(Buckets[Eind tijd]<=(1/24*4);Buckets[Eind tijd]+1;Buckets[Eind tijd])
;
IF(Workforce[Stoptijd]<=(1/24*4);Workforce[Stoptijd]+1;Workforce[Stoptijd]) > IF(Buckets[Start tijd]<(1/24*4);Buckets[Start tijd]+1;Buckets[Start tijd])
)
;
if(IF(Workforce[Stoptijd]<=(1/24*4);Workforce[Stoptijd]+1;Workforce[Stoptijd]) > IF(Buckets[Eind tijd]<=(1/24*4);Buckets[Eind tijd]+1;Buckets[Eind tijd])
;
IF(Buckets[Eind tijd]<=(1/24*4);Buckets[Eind tijd]+1;Buckets[Eind tijd])
;
IF(Workforce[Stoptijd]<=(1/24*4);Workforce[Stoptijd]+1;Workforce[Stoptijd])
)
-
IF(IF(Workforce[Starttijd]<((1/24)*4);Workforce[Starttijd]+1;Workforce[Starttijd]) > IF(Buckets[Start tijd]<(1/24*4);Buckets[Start tijd]+1;Buckets[Start tijd])
;
IF(Workforce[Starttijd]<((1/24)*4);Workforce[Starttijd]+1;Workforce[Starttijd])
;
IF(Buckets[Start tijd]<(1/24*4);Buckets[Start tijd]+1;Buckets[Start tijd])
)
;
0
)
;
IF(AND( Workforce[Starttijd] < Buckets[Eind tijd]
;Workforce[Stoptijd] > Buckets[Start tijd]
)
;
if(Workforce[Stoptijd] < Buckets[Eind tijd];Workforce[Stoptijd];Buckets[Eind tijd])
-
if(Workforce[Starttijd] > Buckets[Start tijd];Workforce[Starttijd];Buckets[Start tijd])
;
0
)
)
-
if(or(Workforce[Starttijd]>= ((1/24)*4);Workforce[Starttijd] > Workforce[Stoptijd]);
IF(AND(
IF(Workforce[Starttijd]<((1/24)*4);Workforce[Starttijd]+1;Workforce[Starttijd]) < IF(Buckets[Eind tijd]<=(1/24*4);Buckets[Eind tijd]+1;Buckets[Eind tijd])
;
IF(Workforce[Stoptijd]<=(1/24*4);Workforce[Stoptijd]+1;Workforce[Stoptijd]) > IF(Buckets[Start tijd]<(1/24*4);Buckets[Start tijd]+1;Buckets[Start tijd])
)
;
if(IF(Workforce[Stoptijd]<=(1/24*4);Workforce[Stoptijd]+1;Workforce[Stoptijd]) > IF(Buckets[Eind tijd]<=(1/24*4);Buckets[Eind tijd]+1;Buckets[Eind tijd])
;
IF(Buckets[Eind tijd]<=(1/24*4);Buckets[Eind tijd]+1;Buckets[Eind tijd])
;
IF(Workforce[Stoptijd]<=(1/24*4);Workforce[Stoptijd]+1;Workforce[Stoptijd])
)
-
IF(IF(Workforce[Starttijd]<((1/24)*4);Workforce[Starttijd]+1;Workforce[Starttijd]) > IF(Buckets[Start tijd]<(1/24*4);Buckets[Start tijd]+1;Buckets[Start tijd])
;
IF(Workforce[Starttijd]<((1/24)*4);Workforce[Starttijd]+1;Workforce[Starttijd])
;
IF(Buckets[Start tijd]<(1/24*4);Buckets[Start tijd]+1;Buckets[Start tijd])
)
;
0
)
;
IF(AND( Workforce[Starttijd] < Buckets[Eind tijd]
;Workforce[Stoptijd] > Buckets[Start tijd]
)
;
if(Workforce[Stoptijd] < Buckets[Eind tijd];Workforce[Stoptijd];Buckets[Eind tijd])
-
if(Workforce[Starttijd] > Buckets[Start tijd];Workforce[Starttijd];Buckets[Start tijd])
;
0
)




)*(if(Workforce[Pauze]=0;0;(Workforce[Pauze]/60) / (Workforce[Gewerkt] + (Workforce[Pauze]/60)))))


*24)


Could somebody help me out with this?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,989
Messages
6,175,808
Members
452,670
Latest member
nogarth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top