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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
sh_12345
Frequent Visitor

Maximum Year and Month

Dear Experts,
Hope you are fine,

I am unable to find the Dax solution, displaying only maximum value of year and month wise of employees from the following table:

 

Month202020212022
Jan 1820020000
Feb 1820020000
Mar 1820020000
Apr 1820020000
May 1820020000
Jun 1820020000
Jul 1820025000
Aug 1820025000
Sep 2000025000
Oct 2000025000
Nov 2000025000
Dec1820020000 

 

Note: Calendar table is made separately.

Please advise any solution

 

 

18 REPLIES 18
v-zhangti
Community Support
Community Support

Hi, @sh_12345 

 

You can try the following methods.

Measure = 
Var _maxvalue=CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Date','Date'[Year]))
Var _mindate=CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),[Value]=_maxvalue))
Return
IF(SELECTEDVALUE('Date'[Month])=MONTH(_mindate),_maxvalue,0)

vzhangti_0-1672813004219.png

Is this the result you expect? If not, please provide more information.

 

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.

Dear @v-zhangti,

 

Thank you i wanted the same result what you provided but i want the employee name in the slicer.

Please advice the same with employee name in the slicer as well

Hi, @sh_12345 

 

Can you provide sample data for testing? Sensitive information can be removed in advance. What kind of expected results do you expect? You can also show it with pictures. 

 

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.

Following tables have been made accordingly in my data as well.

 

1) Employee Name Column has been added in the your PBI Sheet

 

Table - Highest Value  (Including Employee).jpg

 2) Calendar table should be made as displayed follows:

Calendar Table.jpg

 

Execpeted result is what you have mentioned lately, employee name is to be included in the slicer

sh_12345_1-1673249443276.png

 

 

Hi, @sh_12345 

 

Measure = 
Var _maxvalue=CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Date','Date'[Year]))
Var _mindate=CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),[Value]=_maxvalue))
Var _N1=IF(MAX('Date'[Month])=MONTH(_mindate),_maxvalue,0)
Return
IF(SELECTEDVALUE('Table'[Employee Name])<>BLANK(),SUM('Table'[Value]),_N1)

Result:

vzhangti_0-1673250900213.pngvzhangti_1-1673250914800.png

Is this the result you expect?

 

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.

 

Please resend the working using with my Calendar Table DAX calculation that was sent you in the last Msg.

 

sh_12345_0-1673256630801.jpeg

 

Hi, @sh_12345 

 

You can try the following methods.

Measure = 
Var _maxvalue=CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Calender','Calender'[Year]))
Var _mindate=CALCULATE(MIN('Table'[Date]),FILTER(ALL('Table'),[Value]=_maxvalue))
Var _N1=IF(MAX('Calender'[Month No])=MONTH(_mindate),_maxvalue,0)
Return
IF(SELECTEDVALUE('Table'[Employee Name])<>BLANK(),SUM('Table'[Value]),_N1)

vzhangti_0-1673855556123.png

vzhangti_1-1673855576175.png

Please check the attachment.

 

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.

The expected result is still incorrect.

sh_12345_0-1673867416032.png

 

Only the highest value in the year should be displayed at once in the month in the aforementioned table

Hi, @sh_12345 

 

Can you tell the names of the employees in the slicer and how the sample data you provided are connected?

 

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.

sh_12345
Frequent Visitor

i want the maximum value in the above table in the year and Month. Provided that minimum value will be replaced to 0 or blank. 

DimaMD
Solution Sage
Solution Sage

hi @sh_12345 , Can you provide your expected result?

 


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

Expected result will be the maximum value of the year

Dec 2020 - 18,200

Sep 2021 - 20,000

Jul 2022- 25,000

But i want only the maximum value should be displayed in the year in aforementioned table. 

@sh_12345  review the file and tell me if this is your expected result


__________________________________________

Thank you for your like and decision

__________________________________________

Greetings from Ukraine

To help me grow PayPal: embirddima@gmail.com

The table should be displayed all the months and years. The minimum value should be mentioned "0" or blank. Only the maximum value should be displayed. 

Employee names in the slicer

20230103_231000.jpg

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors