Forum Discussion

aTomov's avatar
aTomov
Frequent Visitor
8 years ago
Solved

New to PowerBi - Need help creating a variable/measure .

Hello guys, 

I just started working with PowerBI and I have to make a report, which is calculating the inventory quantities for user selected date. 

I am posting my datamodel, as well as my Measure. 

this is the measure I am using, but i get error " Too many arguments were passed to the IF function. The maximum argument count for the function is 3". 

/////

Quantity up to date = if(INVENTTRANS[DATEPHYSICAL].[Date] <= VALUES(vDate[vDate].[Date]) && INVENTTRANS[DATEPHYSICAL].[Date] > "01-01-2000";Sum(INVENTTRANS[QTY]);;) 

/////

Anyone has any thoughts?

 

  • Anonymous's avatar
    Anonymous
    8 years ago

    If you want to only sum the rows within the selected period, you need to set the measure to something similar:

     

     [Quantity up to date] = CALCULATE(SUM(INVENTTRANS[QTY]), FILTER(INVENTTRANS, INVENTTRANS[DATEPHYSICAL].[Date] <= VALUES(vDate[vDate].[Date] && INVENTTRANS[DATEPHYSICAL].[Date] >= "01-01-2000"))

     

4 Replies

  • aTomov's avatar
    aTomov
    Frequent Visitor

    So basically in the formula i am saying something like

     

    if(Datephysical <= vDate  AND datephysical> 01.01.2000; Sum(QTY);)

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi aTomov,

       

      I think your expression syntax should be:

       

      if(and(Datephysical <= vDate, datephysical > 01.01.2000), Sum(QTY))

      • aTomov's avatar
        aTomov
        Frequent Visitor

        Yep, this is the correct syntax, thank you, but now, When i change the value of vDate, nothing happens to the table.. 

        Any ideas?