cancel
Showing results for
Did you mean:
Highlighted
Resolver I

## Unable to calculate sales for max month

Hi Gurus,

I got Stuck in calculating Sales for the max month based on the selected slicer in power BI.

Senario:

1. I have a dimenssion called Report Type in this I have two attributes (Available , Common).

2. For Available my max date is June-2017 & for Available it is May-2017.

I tried :

1. Created a measure called Max_Date_Competitor= IF(HASONEFILTER(Competitor[ReportType]),MAXX(Competitor,Competitor[TIME_YEAR_MONTH].[Date]))

2. Created another files Max_Sales =

CALCULATE(SUM(Competitor[GROWTH_YTD_NUM_CY]),FILTER(Competitor,Competitor[TIME_YEAR_MONTH].[Date]=[Max_Date_Competitor]))

But System is returing sum of all sales happened since data available.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver I

Hi Yulgu,

Thanks for your time. I solved this problem by reading DAX function from microfoft side https://msdn.microsoft.com/en-us/library/ee634380.aspx

```Max_Sales =
CALCULATE (
SUM ( Competitor[GROWTH_YTD_NUM_CY] ),
lastdate(Competitor[Max_Date_Competitor])
)```
2 REPLIES 2
Highlighted
Microsoft

Hi @SandySharma,

```Max_Sales =
CALCULATE (
SUM ( Competitor[GROWTH_YTD_NUM_CY] ),
FILTER (
Competitor,
MAX ( Competitor[TIME_YEAR_MONTH].[Date] ) = Competitor[Max_Date_Competitor]
)
)```

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.
Highlighted
Resolver I

Hi Yulgu,

Thanks for your time. I solved this problem by reading DAX function from microfoft side https://msdn.microsoft.com/en-us/library/ee634380.aspx

```Max_Sales =
CALCULATE (
SUM ( Competitor[GROWTH_YTD_NUM_CY] ),
lastdate(Competitor[Max_Date_Competitor])
)```

Announcements

#### Power Platform Community Conference

Check out the on demand sessions that are available now!

#### Microsoft Power Platform Communities

Check out the Winners!

#### Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors