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
Anonymous
Not applicable

DAX(Using MAXX)

Hi All,

This is the data I have created in PowerBI. Screenshot is given below:

 

Megha3012_0-1642434755379.png

 

I have the data in the same format in excel. The screenshot is given below:

Megha3012_2-1642435427936.png

 

 

Based on the above columns, I created an other column in excel named Weekly cycle. And the formula I implemented was

=IF(MAX(AE3:AR3)>7,7,(MAX(AE3:AR3))+1).

 

How can I implement the same in data field in PowerBI?

 

Any help is appreciated!

 

Thank you!

Megha

 

1 ACCEPTED SOLUTION

Hi,

Yeah it is possible, you just need to add MAX's iteratively. E.g.

ValtteriN_0-1643046476046.png

 







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
ValtteriN
Super User
Super User

Hi,

It is possible to do this kind of comparion by using nested MAX() functions, but I wouldn't recommend it. Instead you can unpivot the data in PQ. 

Multiselect columns with shift click and press the arrow:

ValtteriN_0-1642436407723.png


Then unpivot columns. Also you can add an index column to keep track of the groups created this way.

ValtteriN_1-1642436509126.png

In my Example I have 4 columns and index column.
Start data:

ValtteriN_3-1642436796917.png

 


After unpivot I have this kind of data:

ValtteriN_4-1642436812587.png


Dax:

Max with if = IF(MAX('MAX'[Value])>7,7,MAX('MAX'[Value])+1)

End result:
ValtteriN_5-1642436834373.png

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @ValtteriN ,

 

Thank you for your reply!

 

Its not pivoted to unpivot.

 

And all the columns are calculated columns which is created by me.

 

I need to implement that formula on the calculated columns in PowerBI.

Can I please know how to do that?

 

Thank you!
Megha

Hi,

If you want to do this with a calculated column you need to use nested MAX functions e.g.

Column =
var _max = max(MAX('MAX'[Column1],'MAX'[Column2]),max('MAX'[Column3],'MAX'[Column4])) return
if(
_max>7,7,_max+1)
 
 
ValtteriN_0-1642438844501.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @ValtteriN,

 

Could you please tell if it is possible to use the same for multiple columns, which is more than 4?

 

Thank you!

Megha

Hi,

Yeah it is possible, you just need to add MAX's iteratively. E.g.

ValtteriN_0-1643046476046.png

 







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thank you! @ValtteriN 

Anonymous
Not applicable

Is it possible to use the same for multiple columns, which is more than 4?

 

Thank you!

Megha

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.

Top Solution Authors