Forum Discussion
date issue
- 9 years ago
Hi eduardo,
had a look at your PBIX - i think you should invest some more time into data modelling, i.e. create dimensions for flights/campaigns/redes and so on.
Start and end dates of campaigns are not "clean" i.e. more than one start date for some campaigns etc.
As for A):
storing this information in a calculated column as you did is just fine.
If you want it in a measure you can do it with this DAX
..Duration = CALCULATE( DATEDIFF( MAX( fDados[data_inicio] ), MAX( fDados[data_fim] ), DAY ))
For column you can define default summarization method to "count" - if thats really what you need, although I'm not sure. If you set this setting to "count" for this column you wont have to change it from "SUM" every time.
As for B)
You can do this with a measure like
..Days Elapsed = DATEDIFF( MAX( fDados[data_inicio] ), TODAY(), DAY )
As for C)
it's not clear to me, what exactly you want to compare -
Running total of CPA could be in a measure like
..RunningCPA = VAR MaxDate = MAX( DimDate[Date] ) RETURN CALCULATE( [.CPA], ALL( DimDate[Date] ), DimDate[Date] <= MaxDate )
but as I said its not entirely clear to me - e.g. in order to determine what is the "previous flight" the flight-dimension would need some kind of "order" or something (look at PBIX file below).
I made some adjustments to your PBIX, you can find it here:
https://dl.dropboxusercontent.com/u/2676210/Mapa%20de%20Campanhas_Novo.pbix
Maybe this helps your understanding a little, let me know where you stand after having a look.
HTH,
Frank
Thanks a lot for the help. I will study in detail each of his teachings.
I will post again reporting the result.
Once again, thank you very much.
eduardo
BetterCallFrank wrote:
but as I said its not entirely clear to me - e.g. in order to determine what is the "previous flight" the flight-dimension would need some kind of "order" or something (look at PBIX file below).
Flights have a relationship like table bellow
2017.1 - 2016.1
2016.2 - 2015.2
2016.1 - 2015.1
2017 - 2016
2016 - 2015
best regards
eduardo