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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
cgil
Advocate I
Advocate I

Last value in a month

Hi all!

 

I need some help.

I have 3 columns in a summarize table (Provincia, Mes(month of the date of the main table, Total).

For each Mes(it is the month of a Date) I have sevaral values for the column "Total" and I only need the value according to the last date of each month.

 

For example:

cgil_0-1640847856111.png

 

For Tarragona I have 217 for December and 222, in this case according to the date I only need the 217 in mi table.

 

Can anybody help me?

thank you so much!

1 ACCEPTED SOLUTION
cgil
Advocate I
Advocate I

Hi all! In the end I solved it using Power M Query, I created a table with this 3 columns I need, then I sort them by the date and I add an index. 

After that I used this formula in DAX: 

if(COUNT(Consulta1[Fecha]) = 1, SUM(Consulta1[Total]), CALCULATE(SUM(Consulta1[Total]), FILTER(Consulta1, Consulta1[Índice] = max(Consulta1[Índice] ))))
 
THanks for your help!

View solution in original post

5 REPLIES 5
cgil
Advocate I
Advocate I

Hi all! In the end I solved it using Power M Query, I created a table with this 3 columns I need, then I sort them by the date and I add an index. 

After that I used this formula in DAX: 

if(COUNT(Consulta1[Fecha]) = 1, SUM(Consulta1[Total]), CALCULATE(SUM(Consulta1[Total]), FILTER(Consulta1, Consulta1[Índice] = max(Consulta1[Índice] ))))
 
THanks for your help!
smpa01
Community Champion
Community Champion

@cgil  can you provide some sample data?


========================
Did I answer your question? Mark my post as a solution!
Proud to be a Super User
My Custom Visualization Projects
• Plotting Live Sound: Live Sound
• Beautiful News: Women in Parliament, Energy Mix, Shrinking Armies
• Visual Capitalist: Working Hrs
• Others: Easing Graph, Animated Calendar
MayViz Submissions
• Week 1: View
• Week 2: View
• Week 3: View
• Week 4: View
========================
wdx223_Daniel
Community Champion
Community Champion

new measure = VAR _MaxDate=CALCULATE(MAX([date]),ALLSELECTED([Mes])) RETURN IF(MAX([date])=_MaxDate,SUM([Value]))

Hi! Thank you for your reply but it doesnt fit what I want...

 

This is my table: 

Resumen = SUMMARIZE(llamadas, LLAMADAS[Provincia],LLAMADAS[Fecha].[Mes],LLAMADAS[Total])
I only look at month because I have values for each week and I only want the different ones.
 
So I get the table of the question where you can see sevaral values for Tarragona in december.
After applying your measure:
cgil_0-1640849943931.png

 

It shows the same... 😥

 

Any suggestion?

Resumen = ADDCOLUMNS(SUMMARIZE(llamadasLLAMADAS[Provincia],LLAMADAS[Fecha].[Mes],"Total",LASTNONBLANKVALUE(LLAMADAS[Fecha].[Date],SUM(LLAMADAS[Total])))

you may translate .[Date] into your language.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.