Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Hi All, hope you can help with this issue i am having -
I have created a "Period Table" within PowerBi that holds the date values as shown on below code:
let
TodaysDate = Date.From(DateTimeZone.FixedUtcNow()),
Ranges = {
{"Today",
TodaysDate,
TodaysDate,
1},
{"Current Week To Date",
Date.From(Date.StartOfWeek(TodaysDate)),
TodaysDate,
2},
{"Last 10 days",
Date.AddDays(TodaysDate,-10) + #duration(1,0,0,0),
TodaysDate,
3},
{"Current Month To Date",
Date.From(Date.StartOfMonth(TodaysDate)),
TodaysDate,
4},
{"Current Year To Date",
Date.From(Date.StartOfYear(TodaysDate)),
TodaysDate,
5},
{"Rolling Week",
Date.AddWeeks(TodaysDate,-1) + #duration(1,0,0,0),
TodaysDate,
6},
{"Rolling Month",
Date.AddMonths(TodaysDate,-1) + #duration(1,0,0,0),
TodaysDate,
7},
{"Last Month",
Date.AddMonths(Date.From(Date.StartOfMonth(TodaysDate)),-1),Date.StartOfMonth(TodaysDate),
8}
},
GetTables = List.Transform(Ranges,
each CreatePeriodTable(_{0}, _{1}, _{2}, _{3})),
Output = Table.Combine(GetTables)
in
Output
I have some problems with the "Last Month" section - i want to show all previous month data but it adds on the 1st day of the current month
Please can you advise what im doing wrong on the code:
{"Last Month",
Date.AddMonths(Date.From(Date.StartOfMonth(TodaysDate)),-1),Date.StartOfMonth(TodaysDate),
8}
Thank You
Hi @v7haquh,
For your issue, I recommand that you post it to Power Query forum. Other partners will read the forums regularly can either share their knowledge or learn from your interaction with us. So you will get the most qualified pool of respondents. Thank you for your understanding.
Best Regards,
Angelia
Many Thanks Angelia, i have done this
User | Count |
---|---|
128 | |
108 | |
100 | |
64 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |