Date differences in Power BI- Power Query - powerbi

Hello Everyone i am trying to get a Days Interval column through getting the differnce between Todays Date and a column Refresh date in Power Query, How do i go about it.
I want to do this in Power Query

= DateTime.Date(DateTime.LocalNow())-[Refresh Date]

Related

Sum over partition by- Power bi

I am trying to achieve this using dax.
I have a table with date, month, year and amount.
I want to create a measure which gives me the desired output in power bi.
This desired output only changes every time there is a change in the date, month and year.
Try the following measure :
DesiredOutput = CALCULATE(
SUM('yourTable'[Amount]),
FILTER(ALL('yourTable'),
'yourTable'[Month]=MAX('yourTable'[Month])))

seeing sales data by "WEEK' in power bi

Can you help me figure out how to display sales data by "WEEKS" in power BI visuals ? I have a calendar table and the date hierarchy is listed by Year, Quarter, Month and Day with no week option.the visual I'd like to create is the chart at the bottom of the image I have attached Thanks
You need to add in the Week to your calendar.
If your are using DAX there are a number of ways
To show the week number of the year use WEEKNUM
Week No = WEEKNUM(Table1[Date], 2)
For the start of the week in a date format use
Start of Week = 'Calendar'[Date] - WEEKDAY('Calendar'[Date],2) +1
The equivalent functions in Power Query are Date.WeekOfYear and Date.StartOfWeek

power bi date measure card

I have a dashboard that needs to display the beginning of the week, on Monday, of the week that I'm in. So for example, if its 1/7/2020, this card would show 1/6/2020. Here is the code I was trying:
Report Date = CALCULATE(TODAY(), FILTER('Calendar', 'Calendar'[WeekStartDate]))
The column in the Calendar table is Weekstartdate, which is accurate and does show the week of 1/6/2020 with the corresponding dates to it; however, it looks like it won't filter it from today's date.
Any ideas? or advice on what I'm doing wrong?
If what you are looking for is a single date, which gives the week start date based on Today's date, you should create a measure:
WeekStartMeasure = TODAY()-WEEKDAY(Today(),2)+1
If you are creating week start date based on a column, then you should create a column with the following calculation:
WeekStartDate = Table[Date]- WEEKDAY(Table[Date],2)+1
Once you create the measure/column, you can use it in the visualization to get the desired result.
We can calculate this way also
if (
WEEKDAY(TODAY(),1) == 1,
TODAY(),
TODAY() - (WEEKDAY(TODAY(),1) - 1)
)

power bi dax last value over a period

I have this table below. How to get Revenue_MTD in DAX? Revenue_MTD equals to the revenue of the last month of each year. The tables are from Tableau and I am converting these to power bi.
with only years:
If you want to get the revenue of the same month previous year you can add a calculated column with this type of dax expression :
Revenue_MTD = SUM(Revenue),
PARALLELPERIOD(
[Date],
-12,
MONTH)
)
you can have more detail on this link :
https://radacad.com/dateadd-vs-parallelperiod-vs-sameperiodlastyear-dax-time-intelligence-question
This is a standard powerbi measure, it should be fairly easy for you to implement this.
MEASURE = CLOSINGBALANCEYEAR(,[,][,])
.
.
.
MEASURE = CLOSINGBALANCEYEAR(SUM(Revenue), DATE )
As long as you have a Date column with appropriate Date Column it should work.
then create another measure with only SUM(revenue)
What expression are you using for your [Revenue_MTD]? Are you using the built-in DAX function TOTALMTD?

How to display current date and time in power bi visuals?

Is it possible to add a card in power BI that shows the current date and tome time??
Many thanks!
You can show only time of last data refresh. Use one of this:
DAX Measure
MyNow = TODAY()
returns single date
PowerQuery
MyNow = DateTime.LocalNow()
returns table with single row & col
Current Date & Time:
MyCurrentDateAndTime := NOW()
The value will be updated each time you open the worksheet.