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

 

Please help me how Can I do the same.

1 ACCEPTED SOLUTION

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])
    )

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
Employee

Hi @SandySharma,

 

Please try this formula:

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.

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])
    )

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.