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
sarjensystems1
Helper III
Helper III

Want to create a calculatetable by taking max values

Hello All,

I want to create a calculate-table by taking max values of 'indirectcontractpricetoday' for every 'Rebate Key'. 

I have used maxx function to create the same but it's gave error like we cannot use maxx function in filter section.

Thanks in advance.

Screenshot (218).png


1 ACCEPTED SOLUTION

@sarjensystems1 

You can try this version:

Table 1 = 
FILTER(
    ADDCOLUMNS(
        'Rebate Copy',
        "Maxvalue", 
            VAR __MAX = CALCULATE( MAX('Rebate Copy'[indirectcontractpricetoday]) , ALLEXCEPT( 'Rebate Copy' , 'Rebate Copy'[Reate Key]] )) 
                RETURN
                IF( 'Rebate Copy'[indirectcontractpricetoday] = __MAX , __MAX)
    ),
    [Maxvalue] <>BLANK()
)
   
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

12 REPLIES 12
Fowmy
Super User
Super User

@sarjensystems1 

Can you try this as a new table from the Modeling Tab:

Table1 = 
SUMMARIZE(
    'Rebate Copy',
    'Rebate Copy'[Reate Key],
    "Maxvalue", MAX( 'Rebate Copy'[indirectcontractpricetoday])
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

@sarjensystems1 

Do not use CALCULATEDTABLE function. Just use the CODE as I shared.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy 
 
Sorry about that, I got your Point, But in my case i want whole Table 'Rebate copy' for my later calculations, that's why i am looking for a dax that should create calculate table with max value.

@sarjensystems1 

If you need the whole table then where do you want to show the max value ?

Do you need a new column that shows the max value for each Key with the new table ? It will repeat

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

hi @Fowmy 

Is it possible to get the max values of 'indirectcontractpricetoday' in itself. Because I just want a table where for every rebatekey there is only one row , i.e. maximum value of  'indirectcontractpricetoday'.

@sarjensystems1 

You can try this version:

Table 1 = 
FILTER(
    ADDCOLUMNS(
        'Rebate Copy',
        "Maxvalue", 
            VAR __MAX = CALCULATE( MAX('Rebate Copy'[indirectcontractpricetoday]) , ALLEXCEPT( 'Rebate Copy' , 'Rebate Copy'[Reate Key]] )) 
                RETURN
                IF( 'Rebate Copy'[indirectcontractpricetoday] = __MAX , __MAX)
    ),
    [Maxvalue] <>BLANK()
)
   
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy 

Thanks for that. It worked .😊

@sarjensystems1 

May be you need the following table with all the records:

Measure = 
ADDCOLUMNS(
     'Rebate Copy',
    "Maxvalue", CALCULATE(  MAX( 'Rebate Copy'[indirectcontractpricetoday]) , ALLEXCEPT(  'Rebate Copy' ,  Rebate Copy'[Reate Key] ))
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi @Fowmy 

According to your dax , i am getting new column named 'maxvalue' having two rows with same value i.e. "31.05".

But I only want a single row where 'indirectcontractprice' = MAX for every rebate key. Attaching screenshot FYR.

I just want first row in my calculated or new table. 
pic2.png

Hi @Fowmy 

Still getting both values in 'indirectcontractpricetoday' for filtered rebate key.

Screenshot (220).png

amitchandak
Super User
Super User

@sarjensystems1 , How are you creating that ?

example

 

summarize( Table, Table[Date], "indirectcontractpricetoday", max(Table[indirectcontractpricetoday]))

Hi @amitchandak 

I have used the dax as mentioned by you, but can you please suggest what should i pass in summarize function as a third paramter, Because I want row with a maximum value of 'indirectcontractpricetoday' for every single 'distinct key'.

Screenshot (219).png

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.