Forum Discussion
2 DAX Questions
- 9 years ago
Hi BGuttmann,
If you need check the year, you can use YEAR function.
Column = IF(WEEKNUM(Table1[Date])=WEEKNUM(TODAY())&&YEAR(Table1[Date])=YEAR(TODAY()),,SWITCH(WEEKDAY(Table1[Date]),1,"Sunday",2,"Monday",3,"Tues day",4,"Wednesday",5,"Thursday",6,"Friday",7,"Satu rday"),"Other Week") And the week is start from Sunday.
Regards,
Charlie Liao
Power Pivot is very different to Excel, and it is very common for Excel Pros to take an approach like this. But I am almost certain there is a better way to do what you want. It looks like you only have a single table. If you want to know day names, the. You should load a calendar table, create a relationship, and use the day name from the calendar table. http://exceleratorbi.com.au/power-pivot-calendar-tables/
Your VLOOKUP question is also probably the wrong question. Can you describe your data and what you want to achieve?
- BGuttmann9 years agoRegular Visitor
I see - okay, so is the "calendar table" just adding a column? I dont see how to add a new table without importing data to powerpivot.
as to the vlookup -- what i am trying to do is take value (what I am calling a bucket) and then look that up in a vlookup.. which then tells me which column to subtract today() from.. basically, I want to see how long a file has been in a certain "bucket" for..
to determine a bucket, I am using a formula to give me a string of numbers,, 1 = the date is populated, 0 = the date is not..
so, 11111001110000 - lets say is bucket
I would use vlookup to find that 11111001110000 is int he bucket "Document Generated - Needs Review"
Then, at this stage, where my question stemmed from, I am using vlookup to then lookup Document Generated - Needs review and return the formula which would be TODAY() minus the column "Document Generated"
- BGuttmann9 years agoRegular Visitor
Okay - i saw how to add the Calendar table and went ahead and did so. Can you tell me what the formula would be to check if a column date is from the current week and if so, return monday, tues,wed, thur,fri,sat or sun?
- v-caliao-msft9 years agoMicrosoft Employee
Hi BGuttmann,
To return weekday name if the date belong to current week, you can use the DAX below.
Column = IF(WEEKNUM(Table1[Date])=WEEKNUM(TODAY()),SWITCH(WEEKDAY(Table1[Date]),1,"Sunday",2,"Monday",3,"Tuesday",4,"Wednesday",5,"Thursday",6,"Friday",7,"Saturday"),"Other Week")Regards,
Charlie Liao
- BGuttmann9 years agoRegular Visitor
Okay, great - and one last question while I have you, I am using the below to form a unique string of numbers to identify what group a particular file should fall into..
=CALCULATE(COUNT([Media Received])+0&COUNT([Demand Generated])+0&COUNT([Demand Atty Review])+0&COUNT([Demand Atty Approved])+0&COUNT([Demand Rejected])+0)&COUNT([Demand Sent])+0&COUNT([Demand Returned Date])+0&COUNT([Client Affidavit Requested Date])+0&COUNT([Client Affidavit Received])+0&COUNT([FDCPA Val Req Rec])+0&COUNT([Validation Letter Generated])+0&COUNT([Validation Reviewed By Atty])+0&COUNT([Validation Rejected])+0&COUNT([Validation Approved])+0&COUNT([Validation Sent])+0&COUNT([Complaint Generated Date])+0&COUNT([Complaint Reviewed By Attorney])+0&COUNT([Complaint Approved])+0)&CONCATENATE([DS<40 Days],[DR>DS]))
this is giving me an error though - where am I going wrong? I just want it to be a 1 if the field has a date and 0 if not..