I`m trying to populate values in column F, "Product Sold Date" in "TABLES" tab
Basically... the logic is as follows:
1) If Column C (Product Status) = "Paused", then return "Paused"
2) If Product start date = NULL or Product end date = NULL, then return NULL
3) If Product start date < today`s date, then return "No Data"
4) If Product start date >= today`s date, return "Upcoming"
5) If product End date <= today`s date, return "Ended"
6) If product start date <= today`s date, return "In Market"
7) If the condition does not belong to any of the above cases, then return the actual Product launch dates
Below is the link to the sample data I`m working on..
I`m pasting the link itself, becaues there are multiple tabs included
https://docs.google.com/spreadsheets/d/120rHOt8Pa_PdMKPgLkSYOKTO2Cv1hBH6PpTrg7FfJLk/edit?usp=sharing
Ultimately, I need to populate the actual "Product Launch Date" by scanning data in each tab
I tried using nested if statements with combination of Index Match.
But I`m totally lost in case of multiple tabs
Can anyone please provide suggestion on this?
Should we think about using query statements instead in this case?
Sidenote: The returned values will be mix of dates and character
[In market/ Ended/ Upcoming/ No Data/ NULL/ Paused/ Actual Date]
=ARRAYFORMULA(
IF(C2:C="Paused", C2:C,
IF((A2:A="")+(B2:B=""), ,
IF(A2:A >= TODAY(), "Upcoming",
IF(B2:B <= TODAY(), "Ended",
IF(A2:A = TODAY(), "In Market",
IF(E2:E<>"", IFERROR(VLOOKUP(D2:D&E2:E,
{'Eaton Centre'!A2:A &"Eaton Centre", 'Eaton Centre'!B2:B;
'Yorkdale Mall'!A2:A&"Yorkdale Mall", 'Yorkdale Mall'!B2:B;
'Vaughan Mills'!A2:A&"Vaughan Mills", 'Vaughan Mills'!B2:B}, 2, 0)), )))))))
Your formula would be
=IF(C2="Paused",C2,if(OR(A2="",B2=""),"",IF(A2<TODAY(),"No Data",IF(A2>=TODAY(),"Upcoming",IF(B2<=TODAY(),"Ended",IF(A2<=TODAY(),"In Market","Actual Product Launch dates"))))))
In the above formula, you should be using a Query formula in place of "Actual Product Launch dates", to extract the actual date.
But the points 3 & 6 don't make any sense. The 6th condtion should be If product start date = todays date, return "In Market"
Related
I am filtering the data based on the current logged in user using the below query, now I would like to return some of the columns associated with that user - how to achieve that ?
In the below case I get only 1 value - I tried to return a complete row but it throws me the error "Multiple columns cannot be converted to a scalar value" - any other way to show multiple columns?
CurrentUserData =
VAR CurrentUserState = CALCULATE(MAX(TimeReport[UserPrincipalName]),FILTER(TimeReport, TimeReport[UserPrincipalName] = USERPRINCIPALNAME()))
RETURN
IF(
SELECTEDVALUE(TimeReport[UserPrincipalName]) = CurrentUserState,
Values(TimeReport[Neukunden_Akquise_Produkte])
)
Reference: https://community.powerbi.com/t5/Desktop/Show-Current-Logged-in-User-data-only/m-p/2219446#M810376
Thanks
Got the solution and credit goes to #miguelarce
https://community.powerbi.com/t5/Developer/RLS-vs-Filter-for-current-user/m-p/329584
Measure1
WhoIsWatching = USERPRINCIPALNAME()
(that is email style usernames, or you can use USERNAME() for windows style users)
Measure 2
FilterByViewer = IF(selectedvalue(table[email])=[WhoIsWatching],1,0)
Drag Measure 2 as a filter for visual, select advanced filtering and set it to
"Show items when value IS 1"
I need to calculate the time spent from one stop to another.
If the trip takes place in the same zipcode area and greater than one hour, I should report it.
For example,
The attached image with the dataframe shows the instance when arrivedTime from one stop to other in same zipcode has difference greater than one hour. I signal it. If it is less than one hour, no action needed. It should be grouped by and order by RuteID, Sequence and arrivedTime. In the attached example, the trip from zipCode 2300 to 2300 takes less then one hour it is ok. But If it is greater than one hour I should report by new column true/false for the number greater than one hour.
I would do this in power query using these steps:
Add a new column "NextSequence" = [Sequence]+1
Do a nested join with the table itsself, linking {"RoutID", "Sequence"} with {"RoutID", "NextSequence"} and when expanding, only keep the departedTime and ZipCode olumns calling them something like "prevDepTime" and "PrevZip"
write an IF-statement saying that if [PrevZip] <> null and [PrevZip] = [ZipCode] and [ArrivedTime]-[PrevDepTime] >= #time(1,0,0) then "Late" else "OK"
Clean up the table, keeping only the columns you want.
Then when loading the new table into power bi I have something that looks like this (I added a ew stops on RoutID2 for testing):
My M-code:
AddNextSequence = Table.AddColumn(PREVIOUS_STEP_NAME, "NextSequence", each [Sequence]+1, Int64.Type),
NestedJoin = Table.NestedJoin(AddNextSequence, {"RouteID", "Sequence"}, AddNextSequence, {"RouteID", "NextSequence"}, "AddedTable", JoinKind.LeftOuter),
ExpandTable = Table.ExpandTableColumn(NestedJoin, "AddedTable", {"DepartedTime", "ZipCode"}, {"PrevDepTime", "PrevZip"}),
Add_OkLate = Table.AddColumn(Expandedtable, "OK_or_Late", each if [PrevZip] <> null and [PrevZip] = [ZipCode] and Number.From([ArriveedTime]) - Number.From([PrevDepTime]) > Number.From(#time(1,0,0) ) then "Late"
else
"OK", type text),
FinalizeTable = Table.SelectColumns(AddOkLate,{"RowNumber", "RouteID", "Sequence", "ArriveedTime", "DepartedTime", "ZipCode", "OK_or_Late"})
in
FinalizeTable
I have three column one is Id(ID is same) 2nd col is amount and third is date, I want difference between two rows(amount)
As you want to have the previous value of the date where the ID is equal, you can use the following:
Add a column,
Column4 =
var baseFilter = FILTER(DiffRows;DiffRows[Column1] = EARLIER(DiffRows[Column1]))
var selectDate = CALCULATE(LASTDATE(DiffRows[Column3]);baseFilter;
FILTER(baseFilter; DiffRows[Column3] < EARLIER(DiffRows[Column3])))
return
DiffRows[Column2] - CALCULATE(sum(DiffRows[Column2]);baseFilter;
FILTER(baseFilter; DiffRows[Column3] =selectDate))
First I create a basefilter to ensure the IDs are same.
Next I select the date whcih is the previousdate within the set of same ids
Last I use this date, to filter the correct value out of the rows.
End result:
I'm creating a dashboard for a sprint overview and want to visualize the progress of the team in a burndown chart. The chart should give information about the amount of user stories that are each new, active and closed. So that in the beginning all user stories are open, then they become active and in the end, there are no open and active stories left.
Now my problem is in modeling the data using DAX.
The data is stored in a big table with a row for each user story that contains all the information on that date. Now, if the information gets modified like in the event of changing the status from new to active or correcting a spelling mistake, the program just adds a new row with a new date.
like in here
The table I want should have the columns date, new, active, and closed. For the date column i have written the following code:
CALENDAR(
FIRSTNONBLANK(
CurrentIterations[StartDate];
CurrentIterations[StartDate] );
FIRSTNONBLANK(
CurrentIterations[FinishDate];
CurrentIterations[FinishDate])
)
But now, oriented on that dates i want the other columns to calculate themselves. In every row I want the amount of user stories in the original table that are active and the latest version on that date.
Examples:
Original table
Wanted table
Wanted burndown chart
Any help greatly appreciated!
Here's another approach.
Calculated table:
MaxRev = CROSSJOIN(VALUES(Test[Id]), VALUES(Test[Date]))
Add the following calculated columns to this table:
MaxRev = CALCULATE(MAX(Test[Rev]),
FILTER(Test, Test[Id] = MaxRev[Id] && Test[Date] <= MaxRev[Date]))
Status = LOOKUPVALUE(Test[State], Test[Id], MaxRev[Id], Test[Rev], MaxRev[MaxRev])
Then use this to create a new calculated table:
Wanted = SUMMARIZE(MaxRev, MaxRev[Date],
"New", CALCULATE(COUNT(MaxRev[Id]), MaxRev[Status] = "New") + 0,
"Active", CALCULATE(COUNT(MaxRev[Id]), MaxRev[Status] = "Active") + 0,
"Solved", CALCULATE(COUNT(MaxRev[Id]), MaxRev[Status] = "Solved") + 0)
Well, it isn't as beatiful, but it does the job. I've created an extra table, to get the last Rev per Id and Day. At least, that's what I thought you meant.
I'm open for better solutions, I'm convinced it can be done better/easier.
'Test' is your original table, make a link on Date to your already created table (Wanted) with the Date column.
Calculated table:
MaxRev =
SUMMARIZE(Test; Tabel[Date]; Test[Id]; "Max"; MAX(Test[Rev]))
Column New (add to table with single date column):
New =
CALCULATE (
DISTINCTCOUNT ( Test[Id] );
CALCULATETABLE (
FILTER (
CROSSJOIN ( 'MaxRev'; Test );
'MaxRev'[Id] = Test[Id]
&& 'MaxRev'[Date] = Test[Date]
&& 'MaxRev'[Max] = Test[Rev]
)
);
Test[State] = "New"
) + 0
Repeat this column, also for Active and Solved.
PBIX file
Power BI Desktop, DAX
I need to help build a control column that finds a bug.
I have three columns: "SN" - serien nr. Data type: text, "MTH" Type data: Whole Number and "Date" Data type: Date.
Each SN has x Mth. Every Mth has just one date.
For each SN, it is true that it can not have more Mth at an earlier date.
Example:
I solved it only by counting the help tables in Query Editor, which took a lot of performance.
I was able to achieve this using the following calculated column:
Control =
VAR BugSN = Bug[SN]
VAR BugMth = Bug[Mth]
VAR BugDate = Bug[Date]
RETURN CALCULATE(
MAX(Bug[Date]),
ALL(Bug), Bug[SN] = BugSN, Bug[Mth] = BugMth
) = BugDate
What this says is that if the date in that row is the max for that SN and Mth combination, then TRUE otherwise FALSE.
(I named the table Bug, but you'll need to replace that with whatever your table name is.)