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
gcyr
Frequent Visitor

Measure - End OF Month based on slicer

Hi,

 

I'm trying to create a measure that will vary based on a slicer selection.

My table has 3 columns. (Date - Index Name - Value)

Currently, I only have 3 index (Index A, Index B & Index C)

I'm trying to get the last data available by month based on the selection of the user in the slicer. The slicer contains the Index Name.

The results I'm trying to get are :

Index A : 2017-09-26

Index B : 2017-09-19

Index C : 2017-09-18

I tried using ENDOFMONTH(Date) but it always returns 2017-09-26 for each Index.

 

Thanks,

Guillaume

 

2 ACCEPTED SOLUTIONS

Hi Guillaume,

 

Check this one please

=Calculate(Max(Table1[Date]),filter(Table1,Table1[IndexName]=earlier(Table1[IndexName])&&Month(Table1[Date])=Month(Earlier(Table1[Date]))))

Regards,

Zubair


Regards
Zubair

Please try my custom visuals

View solution in original post

v-yulgu-msft
Employee
Employee

Hi @gcyr,

 

You can also try this workaround:

 

Create a Month column in your source table: Month = Table1[Date].[Month]

Create a measure like: Last Date = MAX(Table1[Date])

 

Then, add [Index Name], [Month] and [Last Date] into table visual. It will automatically display last date per Index per month.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

5 REPLIES 5
v-yulgu-msft
Employee
Employee

Hi @gcyr,

 

You can also try this workaround:

 

Create a Month column in your source table: Month = Table1[Date].[Month]

Create a measure like: Last Date = MAX(Table1[Date])

 

Then, add [Index Name], [Month] and [Last Date] into table visual. It will automatically display last date per Index per month.

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Both your solution worked.

 

Thanks!

Guillaume

Zubair_Muhammad
Community Champion
Community Champion

Hi Guillaume,

Are you trying a  calculated column or a measure?

 

Try below in a calculated column. I m not sure if this is what you need

=Calculate(Max(Table1[Date]),filter(Table1,Table1[IndexName]=earlier(Table1[IndexName])))



Regards
Zubair

Please try my custom visuals

Hi @Zubair_Muhammad

 

Your formula works for the current month but not for the previous months

For example in August, I have data for all three indexes up to August 31.

Therefore for the month of September I was expecting

Index A : 2017-09-26

Index B : 2017-09-19

Index C : 2017-09-18

And for the month of August (Similar treatment for all preivous months)

Index A : 2017-08-31

Index B : 2017-08-31

Index C : 2017-08-31

 

I don't know if a measure of a calculated column is better for my request.

 

Thanks,

Guillaume

Hi Guillaume,

 

Check this one please

=Calculate(Max(Table1[Date]),filter(Table1,Table1[IndexName]=earlier(Table1[IndexName])&&Month(Table1[Date])=Month(Earlier(Table1[Date]))))

Regards,

Zubair


Regards
Zubair

Please try my custom visuals

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.