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
Jackson123
Resolver I
Resolver I

how dax can calculate field parameter corresponding maximum value dynamically

When switching the year, quarter and month of the field parameters, I hope to get the maximum value of different time periods as the maximum value of the y-axis, but I can't get the maximum value dynamically. The maximum value corresponding to different time intervals can be calculated, but it can't be obtained dynamically. How can I get the maximum value of different time periods dynamically with DAX? That is, when I switch the year, quarter and month of the field parameter, the measurement can automatically obtain the maximum value of the corresponding interval

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached file.

As you can see in the measure, I tried to create additional column [Period CC] in the field parameter table, and then I used this column in the measure.

 

Jihwan_Kim_0-1662701575415.png

 

 

Max qty by period select measure: =
SWITCH (
    SELECTEDVALUE ( Period[Period CC] ),
    "M-Y", MAXX ( VALUES ( 'Calendar'[M-Y] ), [Quantity total measure:] ),
    "Q-Y", MAXX ( VALUES ( 'Calendar'[Q-Y] ), [Quantity total measure:] ),
    "Year", MAXX ( VALUES ( 'Calendar'[Year] ), [Quantity total measure:] )
)

  

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached file.

As you can see in the measure, I tried to create additional column [Period CC] in the field parameter table, and then I used this column in the measure.

 

Jihwan_Kim_0-1662701575415.png

 

 

Max qty by period select measure: =
SWITCH (
    SELECTEDVALUE ( Period[Period CC] ),
    "M-Y", MAXX ( VALUES ( 'Calendar'[M-Y] ), [Quantity total measure:] ),
    "Q-Y", MAXX ( VALUES ( 'Calendar'[Q-Y] ), [Quantity total measure:] ),
    "Year", MAXX ( VALUES ( 'Calendar'[Year] ), [Quantity total measure:] )
)

  

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


hi,kim, 

   thank you very much. Your suggestion is very helpful. According to your example, it is normal to create a column in the field parameter table for measurement judgment. If the original column in the field parameter table is used for judgment, the measurement will report an error. The original column that has been used before can not be found. Thank you again for your help

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