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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
lrozan
New Member

Help with getting the maxvalue for specific dimensions and dates

Hello, this is what i need..I need the lastValue of the "Estado" Column...it will the max value of the column "Año Inscripcion"

 

lrozan_0-1682115413694.png

 

 

 

I have the data at this dimension level

[Documento, Departamento, Nombre de Materia]

 

I want to get the "Estado" column

And i need only for the latest "Año Inscripcion"

 

So i did this, i created a calculated column:

 

 

 

Resultado Ultima Cursada =
  VAR Current_Date = TablaGeneral[Año Inscripción]
  VAR Previous_Date =
      CALCULATE (
          MAX ( TablaGeneral[Año Inscripción] ),
          TablaGeneral[Año Inscripción] <= Current_Date,
          ALLEXCEPT ( TablaGeneral,
        TablaGeneral[Documento],
        TablaGeneral[Nombre de materia],
        TablaGeneral[DEPARTAMENTO] )
      )
  RETURN
      CALCULATE (
          MAX ( TablaGeneral[Estado ] ),
          TablaGeneral[Año Inscripción] = Previous_Date,
          ALLEXCEPT (  TablaGeneral,
        TablaGeneral[Documento ],
        TablaGeneral[Nombre de materia                                                     ],
        TablaGeneral[DEPARTAMENTO] )
      )
 
 
Its working, but for some reason is duplicating the values!
 
The ones that I put in red shouldnt be there
 
 
lrozan_2-1682115220699.png

 

Can you help me fix that DAX function?


Thanks

 

 

1 REPLY 1
Anonymous
Not applicable

Hi  @lrozan ,

 

You can try the following dax;

Resultado Ultima Cursada =
  VAR Previous_Date =
      CALCULATE (
          MAX ( TablaGeneral[Año Inscripción] ),
          ALLEXCEPT ( TablaGeneral,
        TablaGeneral[Documento],
        TablaGeneral[Nombre de materia],
        TablaGeneral[DEPARTAMENTO] )
      )
  RETURN
      CALCULATE (
          MAX ( TablaGeneral[Estado] ),
          'TablaGeneral'[Año Inscripción]=Previous_Date,
          ALLEXCEPT (  TablaGeneral,
        TablaGeneral[Documento],
        TablaGeneral[Nombre de materia],
        TablaGeneral[DEPARTAMENTO] )
      )

If I have misunderstood your meaning, please provide your desired output and your pbix file without privacy information.

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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