If condition on multiple column variables, Power bi - if-statement

I am trying to create a column or measure based on below condition. Thanks in advance.
-- when date is maximum and status is closed return "close" for the shipment for all dates and if max date has "Open" as status return "Open" for all dates for that shipments.

Related

Date differences in Power BI- Power Query

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]

Add previous month column DAX Power BI

I have a fact table which has 'Last Data Update' column that shows current month date(mm/dd/yyyy), 06/13/2022.
I am trying to add column called 'report month' that returns a value that shows previous month/year 05/2022 to create relationship with calendar table.
=Date.Month([Last Data Update])-1
I have used this code, but this only returns 5 and it is in number format.
is there a way to return 05/2022 in DAX ?
Thanks in advance.
This is M, not DAX. Replace your custom column with the following code:
Text.PadStart( Text.From(Date.Month([Last Data Update])-1),2,"0") &"/"& Text.From(Date.Year([Last Data Update]))
It worked for we with this 3 simple steps:
Step 1: Create a column with current year (True/False statement) by using:
CurrentYear = IF(YEAR([Last Data Update])=YEAR(NOW()),1,0)
Step 2: Create a column that will indicate if the current date (based on column "Last Data Update") belongs to previous month or not (True/False statement).
PreviousMonth = IF([CurrentYear]=1 && (MONTH(TODAY())-1)=MONTH([Last Data Update]),1,0)
Step 3: Create a filter on your visual where you select filter "PreviousMonth" with value "1" to show dates only from previous month).
If you like it. Don't forget to rate it.
Success,
Mark
This month-year
FORMAT( [Last Data Update], "mm/yyyy")
previous month
FORMAT( DATEADD([Last Data Update],-1,Month), "mm/yyyy")

Using Date Range from a Slicer in a DAX Query PowerBI

I have a date slicer that is controlled by the user. I am trying to use the users min/max date selection as a indicator. I have created two measures - one for the min value and another measure for the max value. Please see DAX code for one below:
NewMin = CALCULATE(FIRSTDATE('Master Query'[RegisterDate]),ALLSELECTED('Master Query'))
Now, on the Master Query Table there is a column that holds date values in the format of dd/mm/yyyy 00:00:00...I am adding another column and using a if statement to get a 0/1 output (i.e. checking if the date column is between the min and max date slicer selection) but it is not working. See DAX Below:
RangeCheck = IF('Master Query'[RegisterDate] >= 'Master Query'[NewMin] && 'Master Query'[RegisterDate] <= 'Master Query'[NewMax],1,0)
This does not work and I am unsure as to why. It seems its not recognising the dates or cant decipher if date is between the two min and max boundries.
A calculated column cannot read in dynamic filters from slicers. Calculated columns are only computed once per time the model is refreshed, not in response to interaction slicers or the filter pane.
In contrast, measures do work for dynamic calculations (though not when you try to use them within a calculated column).

Power Bi - Count for a category for each month

I am just starting out with PowerBi. Please use the table below as my sample. Assume that the Order Table has a *-1 relationship with Order Status.
I want to create a bar graph to see the number of each Order Status by Month.
The month is at the bottom and each month potentially has 3 bars. 1 bar representing the count of each Order Status for that month.
I need some direction. I know this is an open-ended question, but I at a total loss.
I have created the same tables as you provided and joined them on order status id (*-1 relationship). Then created the status column.
Status = RELATED('Order Status'[Status] )
Dragged and dropped this column on to the clustered column chart under legend and values (default summarised as count). Then got the following visual.

Need to limit the date in a slicer by today's date in Power BI

I am building a report in Power BI Desktop, created a slicer - YearMonthSort - which has data selection by Year-Month
Plz, see the screenshot below:
My goal is to limit data in this slicer as -
2015-07 to today's date
(whichever it will be when users will look at the data,
in the same format - "YYYY-MM")
In the "Filters" section I can select my starting year as 2015-07,
but having problem setting today's date.
I tried to create the new Measure, but not sure where to place it,
or, may be there is another way to perform this:
IsToday = FORMAT(TODAY(), "mm/yyyy")
I only just started to learn this,
Thank you for help in advance!
You can do the following:
I am assuming that you are using a calendar table that is joined to your fact table on a date field and that your year sort column is calculated with reference to the 'date' field in your calendar table.
Assuming, this is true you can create a calculated column that will flag whether or not the date field is before or after today. This can be achieved by using the following DAX:
IsToday =
SWITCH (
TRUE (),
'Calendar'[Date]
<= NOW (), 1,
0
)
Then, in your visual add a 'Visual Level Filter' using this new column and set it to 1.