Forum Discussion
rafamorim87
2 years agoFrequent Visitor
Datediff Probleam
Goodnight I would like some help, I have a database that has employee names and their hire dates. I created the formula to calculate company time based on the date entered in the filter. I created ...
- Anonymous2 years ago
Change your vLastDate to:
CALCULATE(LASTDATE(dimCalendario[Data]), ALLSELECTED(dimCalendario))The problem is that your date context in your table means "LastDate" is currently giving you the last date of that year, which will always be a datediff of 0.
- Anonymous2 years ago
Best practise is to model your data in a Star Schema. I would suggest adding to your model a "Person" table, that contains 1 row per person. Then use a unique ID to create a relationship between your person table and the data table. When building your visuals, use the Person table's fields on your report. When using the measure, this will constrain your measure to run once for each person.
To creature an average, we'll use the Average iterator function. I'll assume you have a person table for my example:
Average Example = AVERAGEX( VALUES('People'[Person Name]), [Tempo de Empresa] )