Forum Discussion
Data manipulation
- 6 years ago
Hi gco ,
Measure NewValue = var _pDate = MAX(NVAL[ProcessDate]) var _tDate = MAX(NVAL[TransDate]) var _tValue = Calculate(MAX(NVAL[Value]), ALLEXCEPT(NVAL,NVAL[ProcessDate],NVAL[Code]),NVAL[ProcessDate]=_pDate+1) return IF (_pDate <> _tDate,_tValue, MAX(NVAL[Value]))
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Sorry, the format is YYYY-MM-DD, and then i just change it to MM/dd/YYYY in PowerBI.
Hi gco ,
Measure NewValue =
var _pDate = MAX(NVAL[ProcessDate])
var _tDate = MAX(NVAL[TransDate])
var _tValue = Calculate(MAX(NVAL[Value]), ALLEXCEPT(NVAL,NVAL[ProcessDate],NVAL[Code]),NVAL[ProcessDate]=_pDate+1)
return
IF (_pDate <> _tDate,_tValue, MAX(NVAL[Value]))
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
- gco6 years ago
Resolver II
Hi Nathaniel_C
Your measure worked perfectly! I am not sure how you guys come up with all these answers. I am very interested to know how you guys learned all these tricks.
Thank you again.
Glen
- gco6 years ago
Resolver II
Hi Nathaniel_C ,
I have not formally read any books. But i went to Microsoft free powerbi trainings.
Most of the work i do is on the SQL side, so i tend to design my query so that i don't pull a lot of data into the report. But most of my calculations are done within powerbi so that it does not slow down my query. Most of the measures i currently use on all my reports are just repeats of past reports - with some additional features added. And most of what i need i am able to figure out - just simple dax (based on what i know in SQL, i just try to translate it into dax). And most of it come from the forums and community. But i would look at the reference you mentioned and also try to use variables on my future projects.
Thanks again
Glen
- Nathaniel_C6 years ago
Community Champion
Thank you Glen for the kind words, you are welcome!
What books have you read?
Nathaniel.
I can recommend two depending on what level you are at right now. MattAllington Supercharge Power BI and KenPuls M is for (Data) Monkey. Look for patterns and use variables a lot.