Forum Discussion

jrscaletta's avatar
jrscaletta
Icon for Helper II rankHelper II
4 years ago
Solved

Comparing TEXT vs INT not allowed.. but I'm using FORMAT!!

Hi!!  obtain an error comparing "TEXT" vs "INT", but I'm using FORMAT too, I don't understand. I want this measure returns weighted average by date,,, ideas? Thanks you!

 

My measure is:

 

Weighted Average by Date =
FORMAT(
SUMX(
FILTER(MOVIGRANJ, MOVIGRANJ[MovementType] = 3 & MOVIGRANJ[ArticleType] = 1),
MOVIGRANJ[Date].[Date]*MOVIGRANJ[AnimalsNumber]/MOVIGRANJ[AnimalsNumber]),
"General Date")

 

Thanks in advance

  • tamerj1's avatar
    tamerj1
    4 years ago

    jrscaletta 
    You can use

    Weighted Averaged Date Movement type 1 = 
    FORMAT (
        SUMX (
            FILTER ( Hoja1, Hoja1[MovementType] = 1 && Hoja1[ArticleType] = 1 ),
            Hoja1[Date] * Hoja1[AnimalsNumber]
        ) / [AnimalsMovementType1],
        "General Date" 
    )

10 Replies

  • Thnanks you very much! Now it works, but the result isn't correct, I obtain date "10/8/2143", when my most recent date is "02/05/2022"...

     

    Ideas? Thanks

      • jrscaletta's avatar
        jrscaletta
        Icon for Helper II rankHelper II

        Hi tamerj1!! Thanks for your reply!

        I want to calculte the average date ponderated by AnimalsNum with criteria.

        All my movements are on the MOVIGRANJ table (date too).

         

        I have 4 important fields for this:
        - DATE (Date)

        - NUM ANIMALS (Integer)

        - MOVEMENTTYPE (Integer)

        - ARTICLETYPE -or product- (Integer)

        - FARM (integer)

         

        I need to calculate the average date ponderated by AnimalsNum with criteria on fields "MOVEMENTTYPE = 3" and "ARTICLETYPE = 1".