Forum Discussion
Max month for max year
Hi everyone,
I'm trying to calculate an inventory turnover with Power BI.
I want to divide those two columns : Volume that we have in stocks / volume that we sold (for that, it is ok, my measure is a simple divide)
And then I want to divide it by the last month of the last year
I've tried this, but it doesn't work :
Hello Anonymous
If my post helped you, please give me a 👍kudos and mark this post with Accept as Solution.
If I understood you correctly, this should be your solution.VAR LastYear = MAX('Company$Commision Entries'[Année nbre]) VAR MaxMonth = CALCULATE( MAX('Company$Commision Entries'[Mois]), FILTER( 'Company$Commision Entries', 'Company$Commision Entries'[Année nbre] = LastYear ) ) RETURN DIVIDE( [Volume in Stock], [Volume Sold] * MaxMonth )
Best regards from Germany
Manuel Bolz
🟦Follow me on LinkedIn
🟨How to Get Your Question Answered Quickly
🟩Fabric Community Conference
🟪My Solutions on Github
3 Replies
- ManuelBolz
Responsive Resident
Hello Anonymous
If my post helped you, please give me a 👍kudos and mark this post with Accept as Solution.
If I understood you correctly, this should be your solution.VAR LastYear = MAX('Company$Commision Entries'[Année nbre]) VAR MaxMonth = CALCULATE( MAX('Company$Commision Entries'[Mois]), FILTER( 'Company$Commision Entries', 'Company$Commision Entries'[Année nbre] = LastYear ) ) RETURN DIVIDE( [Volume in Stock], [Volume Sold] * MaxMonth )
Best regards from Germany
Manuel Bolz
🟦Follow me on LinkedIn
🟨How to Get Your Question Answered Quickly
🟩Fabric Community Conference
🟪My Solutions on Github- AnonymousNot applicable
Thank you for your help !! it works 😄
- mh2587
Super User
InventoryTurnoverLastMonthLastYear = //Try this might help you VAR LastYear = CALCULATE( MAX('Company$Commision Entries'[Année nbre]), ALL('Company$Commision Entries') ) VAR MaxMonthLastYear = CALCULATE( MAX('Company$Commision Entries'[Mois]), FILTER( 'Company$Commision Entries', 'Company$Commision Entries'[Année nbre] = LastYear ) ) RETURN DIVIDE( CALCULATE( SUM('Company$Commision Entries'[VolumeInStock]), FILTER( 'Company$Commision Entries', 'Company$Commision Entries'[Année nbre] = LastYear && 'Company$Commision Entries'[Mois] = MaxMonthLastYear ) ), CALCULATE( SUM('Company$Commision Entries'[VolumeSold]), FILTER( 'Company$Commision Entries', 'Company$Commision Entries'[Année nbre] = LastYear && 'Company$Commision Entries'[Mois] = MaxMonthLastYear ) ), 0 )