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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
marcos_moraes
Helper I
Helper I

Filter inventory, then starting and ending date and gain weight of cattle

Hello,

I am working with inventory of cattles. 
Need to segregate cattle that went to "Confinamento" (Pasto_DimDescricao), the first date and last date it was weighted (Data PS) and the weight (Peso) in those dates to know the gain weight during those days in "confinamento". 

marcos_moraes_0-1636321074245.png

I have the measures for the first and last date, but don`t know how to do a measure to find only cattle that went to "Confinamento".

Data Primeira Pesagem =
VAR varCurrentID =
MIN('DataArquivo_Fato'[IDL])
VAR varCurrentDate =
CALCULATE(MIN('DataArquivo_Fato'[Data Ps]),
REMOVEFILTERS('DataArquivo_Fato'[Data Ps]))
RETURN
varCurrentDate
 
Thanks for your help.
Rose
1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @marcos_moraes ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @marcos_moraes ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @marcos_moraes ;

I am very sorry that I did not understand the result and meaning you want to output. As I understand it, the earliest date for each IDE is "confinamento", right? If so, try:

Data Primeira Pesagem2 = IF(MAX([Pasto_DimDescricao])="Confinamento",
CALCULATE (
    MIN ( 'DataArquivo_Fato'[Data Ps] ),
    FILTER (
        ALL(DataArquivo_Fato),[IDE]=MAX([IDE])&&
        'DataArquivo_Fato'[Pasto_DimDescricao] = "Confinamento"
    )
))

The final output is shown below:

vyalanwumsft_0-1636518728565.png

If not, can you share me more details about your logic? and  share some scenario about result what you want to output?

The most important parts are:
1. Sample data as text or screenshots.
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

VahidDM
Super User
Super User

Hi @marcos_moraes 

 

Try this:

Data Primeira Pesagem =
CALCULATE (
    MIN ( 'DataArquivo_Fato'[Data Ps] ),
    FILTER (
        ALL ( 'DataArquivo_Fato' ),
        'DataArquivo_Fato'[Pasto_DimDescricao] = "Confinamento"
    )
)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos!!

 

Hi VahidDM,

Unfortunately, it didn`t work.

Measure is considering the first date of the first register such as:

marcos_moraes_0-1636373409544.png

 

rgds

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.