Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
jrscaletta
Helper II
Helper II

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

1 ACCEPTED SOLUTION

@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" 
)

1.png

View solution in original post

10 REPLIES 10
jrscaletta
Helper II
Helper II

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 

What are you trying to calculate?

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".

Can you share screenshot of your source data table or provide sample data?

Hi Tamerj1! Thanks you again, now I'm understand your budget of Community Champion 😀

 

The file: https://we.tl/t-38IudN69ZO

 

You can see "Fecha entrada ponderada" and "Fecha salida ponderada" is not logical result.

 

Thanks!!!!

@jrscaletta 
Apperantly this is something else. I need all the details. Please share a sample file to work with.

Hi Tamerj

 

I attach basic and easy compensive sample file. Thanks! Download file (By Wetransfer): https://we.tl/t-0NhKxNu8Ql

As you can see, the weighted average date is not correct. It shows 2045 year!! My data is all 2022.

 

0G34Nyi

 

Thanks!!

@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" 
)

1.png

It works!!! Thanks you so much for your help!

tamerj1
Super User
Super User

Hi @jrscaletta 
A small mistake

1.png

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors