Forum Discussion

H1r0ka's avatar
H1r0ka
Frequent Visitor
7 years ago
Solved

Var Formula error--Datesbetween

Hello,

 

I'm trying to add 'datesbetween' for the following formular. However I could not get any value.

Could you please support how to modify it?

 

Column 2 = VAR sales_total =
     calculate([Actual Total],DATESBETWEEN(DateDimensions[Date],nextday(SAMEPERIODLASTYEAR(LASTDATE(DateDimensions[Date]))),LASTDATE(DateDimensions[Date])))
RETURN
    IF(
        AND (sales_total >= 0, sales_total < 1000 ),
        "Minor",
         IF(
             AND ( sales_total > 5000, sales_total < 20000 ),
             "General",
          ) )

  • Hi H1r0ka,

     

    As we know, measures could not be added to Goup / X-axis in visuals, So here we need to create a calculated column in SalesTable.

     

    measu1 = VAR sales_total =
    calculate([Actual Total],DATESBETWEEN(DateDimensions[Date],nextday(SAMEPERIODLASTYEAR(LASTDATE(DateDimensions[Date]))),LASTDATE(DateDimensions[Date])))
    
    RETURN
        IF(
            AND (sales_total >= 0, sales_total < 50 ),
            "Minor",
             IF(
                 AND ( sales_total > 50, sales_total < 20000 ),
                 "General"
              ) )

     

    For more details, please check the attachment.

     

    Regards,

    Frank

7 Replies

    • H1r0ka's avatar
      H1r0ka
      Frequent Visitor

      Hello v-frfei-msft,

       

      Thank you very much for your support.

      Datedimensions is date table.

      DateDayMonthYear
      1-Sep-18192018
      2-Sep-18292018
      3-Sep-18392018
      4-Sep-18492018
      5-Sep-18592018

      SalesTable contains sales date.

      [Actual] is calculationfield of ( [Local Price]/[Rate]) and [Actual Total] is calculation field of (Sum [Actual]).

      SalesKeyDateCustomerIDLocal PriceRateActual
      0011-Sep-179901200011018.2
      0021-Oct-179902300011526.1
      0033-Sep-189901500012041.7
      0043-Sep-1899031000012083.3
      0056-Sep-189903300012025.0

       

      Rank Table is list of rank.

      RankType
      0>=, 1000<Minor
      5000>, <20000General

       

      Thank you in advance,