Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Problems with SWITCH and IF in DAX

$
0
0

Hi

I'm trying to create a TotalHours measure in my Model that is connected to OCLG table in SAP Business One. In this table that store the activities exist the DurType Field which values are 'H', 'M'  or 'D'. 

 

In my SQL sentences, I use this: select sum (case when DurType='M' then Duration/60 else Duration end) from OCLG

 

And Now I want to translate this to DAX. But when I write this

 

TotalHoras = SWITCH(Horas[DurType],'M',Horas[Duration]/60,'H',Horas[Duration])

 

I have error: Cannot find table 'M'

 

But If I use IF I have error too

  

TotalHoras = IF([DurType]='M',[Duration]/60,[Duration])

 

Any idea, please?

 

regards


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>