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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Get the first [or only] value of a column of a given filtered table

Hey everyone, what's up?

 

I have a table that looks like this:

tabela-inpc.PNG

The values goes, untill year 2019 month 9.

 

There's only one row for each month-year combination. That means that DataReferencia field is unique (key).

 

It's used for restatement of currency values.

 

It's called 'INPC'.

 

I need a DAX formula that gets the first value of a specified column (in the case, the column NUMERO INDICE) of a filtered given table (in the case, the 'INPC' table).

 

To be clear, here's what I'm looking for:

 

[FUNCTION I'M LOOKING FOR] (
     'INPC'[NÚMERO ÍNDICE];
     TOPN(
          1;
          'INPC';
          'INPC'[DataReferencia];
          DESC
          )
     )

The filtered table I'm passing is a one row table, given by the TOPN function.

That made, I need to get the corresponding value of the NÚMERO ÍNDICE column.

 

To be short, I need a function that will return me the NÚMERO ÍNDICE value corresponding to the most recent date of DataReferencia field. I used TOPN to give me the row corresponding to the most recent date. Now I need a function that gets the unique value of the NÚMERO ÍNDICE column from this filtered table.

 

Any ideas?

1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

Hi @Anonymous ,

 

Not sure if I understand this, but if you create this measure, you will be able to get the Numero Indice from the row that contains the latest date in the table.  

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

Numero Indice measure = CALCULATE(max(Numero[Numero Indice]),Filter(Numero,Numero[Date]=MAX((Numero[Date]))))

I called my table Numero.

 

 

numero.PNG

numero 1.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
Nathaniel_C
Super User
Super User

Hi @Anonymous ,

 

Not sure if I understand this, but if you create this measure, you will be able to get the Numero Indice from the row that contains the latest date in the table.  

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

 

Numero Indice measure = CALCULATE(max(Numero[Numero Indice]),Filter(Numero,Numero[Date]=MAX((Numero[Date]))))

I called my table Numero.

 

 

numero.PNG

numero 1.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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