Help building a DAX formula

shophoney

Active Member
Joined
Jun 16, 2014
Messages
281
Hi I'm looking at finding out what the last discount code is in a table.

table:"tblInvPriceDisc"
Fields:"start date","discount_amt"

So I would like to know the last date it went on sale and what the amount is. I would guess something with Max Value??

Then take the discount and reduce the "retail" in "tblinvskumaster". Does the table have to be related? It's connected to the calendar table for dates. So it gives me an error when I try to use the related function? Do I need to import a second table as I can only relate one field at a time?

One last thing. Sample problem:
=if('tblinvpriceDisc'[disc_type]="%",'tblinvskumaster[retail]*'tblinvpriceDisc'[disc_amt],if('tblinvpriceDisc'[disc_type]="$",'tblinvskumaster[retail]-'tblinvpriceDisc'[disc_amt],if('tblinvpriceDisc'[disc_type]="o",'tblinvpriceDisc'[disc_amt],)))

If i had the discount I would think something like above might work to figure out the current net price.

Thanks
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
I think you'all get better answer if you can describe what the actual calculation is. 'the last date it was on sale' doesn't mean anything to me.

Do you mean "find the latest date in the start date column and find the value in the discount amount column that matches?' If so you want something like.

Code:
CALCULATE (
    VALUES ( table[discount amount] ),
    FILTER (
        ALL ( table[start date] ),
        table[start date] = MAX ( table[start date] )
    )
)
 
Upvote 0

Forum statistics

Threads
1,216,079
Messages
6,128,687
Members
449,464
Latest member
againofsoul

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top