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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
KimberleyDgs
New Member

Retourner une valeur en fonction d'une mesure

Bonjour,

 

J'ai réussi à stocker dans une colonne les dernières dates du mois précédent :

KimberleyDgs_0-1650023375521.png

Et je cherche maintenant à créer une mesure qui me retournerait les valeurs des clôtures à cette date calculée précédemment (28/02/2022).

 

KimberleyDgs_1-1650023467789.png

Quelqu'un a une idée ?

 

Merci.

 

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @KimberleyDgs 

 

I simulated some data. You can try the following methods.

Max date = 
CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Product]))
Current sales = 
CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),[Date]=[Max date]&&[Product]=SELECTEDVALUE('Table'[Product])))

vzhangti_0-1650353010499.pngvzhangti_1-1650353032087.png

Does this look like the result you were hoping for?

 

Best Regards,

Community Support Team _Charlotte

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

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @KimberleyDgs 

 

I simulated some data. You can try the following methods.

Max date = 
CALCULATE(MAX('Table'[Date]),ALLEXCEPT('Table','Table'[Product]))
Current sales = 
CALCULATE(SUM('Table'[Sales]),FILTER(ALL('Table'),[Date]=[Max date]&&[Product]=SELECTEDVALUE('Table'[Product])))

vzhangti_0-1650353010499.pngvzhangti_1-1650353032087.png

Does this look like the result you were hoping for?

 

Best Regards,

Community Support Team _Charlotte

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

amitchandak
Super User
Super User

 

 

 

Last Month end date =
var _max = eomonth(_max,-1)

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date]  =_max ) )


2nd last month =
var _max1 = if(day(today() )=1 , eomonth(today(),-1), today())
var _max = eomonth(today(),-2)

return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Table'),'Table'[Date] =_max ) )

 

In case you have date in slicer , you can use maxx(allselected(Date),Date[Date]) in place of today

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.

Top Solution Authors