Forum Discussion
YoY Comparison without date
- 1 year ago
We can solve this very easily, it is enough to create a calculate column in your fact table with the first date of each quarter, this column will be of type date (it will automatically get Date/Time Data type in Tabular, but you can convert it in Power BI Desktop (not on Power Query, it will not be visible there) to Date.
Calculated column name and code:
First Quarter Date =
VAR _Year = INT ("20"&RIGHT(YourFactQuarterColumn, 2))VAR _MonthNr =
VAR _QuarterNr = LEFT ( YourFactQuarterColumn, 2)
RETURN
IF (
QuarterNr = 1, 1,
IF (
QuarterNr = 2, 4,
IF (
QuarterNr = 3, 7,
10
)
RETURN
DATE ( _Year, _MonthNr, 1 )If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
You do not have a calendar table but are you allowed to create one in DAX ? I can provide the code.
Time intelligence is very easy with a calendar table but very hard without it
If this helped, please consider giving kudos and mark as a solution
me in replies or I'll lose your thread
consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
- FabioB71 year agoNew Member
FBergamaschi , yes, I do not have a calendar table, that's my problem here, but I am allowed to create one in DAX (at least I think so) as I own the full database
Is this something that you can help me?