Power BI Date Calculated Indicator - dax

Fairly new to DAX so I'm hoping some one can point out where I am going wrong with this code which to check and see if a feild falls within a period based on today and display an indicator.
Thanks In Advance
T
My Code:
Update Health = IF([Project Modified Date]= NOW() <= (NOW()-10),'Projects'.[PWA URL] & "/_layouts/15/inc/PWA/images/cf_6p.png",IF([Project Modified Date]=NOW() <= (NOW()-5),'Projects'.[PWA URL] & "/_layouts/15/inc/PWA/images/cf_1p.png",IF([Project Modified Date]=NOW() <= (NOW()-1),'Projects'.[PWA URL] & "/_layouts/15/inc/PWA/images/cf_2p.png",'Projects'.[PWA URL] & "/_layouts/15/inc/PWA/images/cf_11p.png")))
MS Code The Above Is Based On:
Schedule Health = IF([SKPI]="Less than 10% over baseline schedule",[PWA URL] & "/_layouts/15/inc/PWA/images/cf_6p.png",IF([SKPI]="Between 10%-20% over baseline schedule",[PWA URL] & "/_layouts/15/inc/PWA/images/cf_1p.png",IF([SKPI]="At least 20% over baseline schedule",[PWA URL] & "/_layouts/15/inc/PWA/images/cf_2p.png",[PWA URL] & "/_layouts/15/inc/PWA/images/cf_11p.png")))

I found I needed a new column and not a new measure.
T

Related

Got Error "Command Get label of interval: not available for current selection" when trying to edit selections with certain labels

I was trying to replace certain selections of sounds with silences, but before I could get into the essential part, the "Get label from interval" command failed before I was able to check whether I'd obtained the correct output.
Error Message I've Got on Praat
I'd thought it was some problems with the toy audio I played with, so I switched to another one but strangely enough, every time I always got stuck with the third interval in the sequence. Screenshot available here:
The Third Interval was Strangely not Available
The code I'm using right now is quite simple as below:
There could be problems with how I process the intervals labelled as "sounding", but it should not be relevant to the error I got here.
----------------------------------------------------------------------------
soundname$ = chooseReadFile$: "Open a sound file"
sound = Read from file: soundname$
gridname$ = chooseReadFile$: "Select the corresponding TextGrid file."
grid = Read from file: gridname$
tier = 1
soundEnd = Get total duration
numOfIntervals = Get number of intervals: tier
writeInfoLine: "Number of Intervals:", numOfIntervals
appendInfoLine: "**** Starting to Replace Selected Sounds... ****"
for interval from 1 to numOfIntervals
appendInfoLine: "Interval#", interval
label$ = Get label of interval: tier, interval
appendInfoLine: "Interval#", interval, ": ", label$
if label$ == "sounding"
startTime = Get starting point: tier, interval
endTime = Get end point: tier, interval
newSilence = Create Sound from formula: "new_silence", 1, startTime, endTime, 44100, ~ 0
before = Extract part: 0, startTime, "rectangular", 1, "no"
after = Extract part: endTime, soundEnd, "rectangular", 1, "no"
selectObject: before, newSilence, after
new = Concatenate
Write to WAV file... "new".wav
removeObject: before, newSilence, after
endif
endfor
appendInfoLine: "Finish!"
----------------------------------------------------------------------------
I'd suspected that it was because of my editing that some shifts occurred in the TextGrid-- however, since I only supplanted the sounds with silences that were of the same length, there should not be impacts on sounds or TextGrids afterwards. However, since I never had the chance to output some playable audio results, all I inferred above could not be corroborated by solid truth.
Thank you all so much for your kind attention and help in advance!

How to Keep Script running for Auto Print and then Delete [duplicate]

I have written a .vbs script which presently is run manually by users. How can I make this script schedule itself in Task Scheduler (to run at a fixed time each day automatically) on Windows XP and Windows 7 the first time it is executed manually?
EDIT
Option Explicit
Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell")
Dim FSO : set FSO = CreateObject("Scripting.FileSystemObject")
Dim StartTime,Elapsed
'msgBox(oShell.CurrentDirectory)
'MsgBox(FSO.GetFile(Wscript.ScriptFullName).ParentFolder )
oShell.CurrentDirectory = FSO.GetFile(Wscript.ScriptFullName).ParentFolder
StartTime = Timer
oShell.run "ParentChildLinkFinal.vbs", 1, True
oShell.run "Parent_Child_Merge_final.vbs", 1, True
oShell.run "CycleTime.vbs", 1, True
oShell.run "Baddata.vbs", 1, True
oShell.run "Matrixrefresh.vbs", 1, True
Elapsed = Timer - StartTime
MsgBox("Total time taken to finish this task:" & Elapsed & "in Seconds")
Thanks,
Create a scheduled task to run the following command:
c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS
You can certainly make a vbs file a scheduled task.
The caveat, though, is you want NOTHING to prompt the user...no inputs, no message boxes, nothing. Make sure you've handled and logged your exceptions or you could find yourself with a task that never completes (or worse, operations angrily calling you because a message box popped up at 3am and halted a production process)
on Windows 8: windows tasks that are triggering VBScripts having message boxes will only display the message boxes if the windows task is run under the same user who really is logged on the machine and the if the windows task is configured to "run only if the user is logged on"
I think this changed on windows 8, as on windows 7 I did not had to configure the task in that way
try this
X=MsgBox("Take the Quiz!")
name=inputbox("Name")
q1=inputbox("Question 1 - How many days are there in a leap Year?")
q2=inputbox("Question 2 - How many Suns does Neptune have?")
q3=inputbox("Question 3 - What is your name?")
q4=inputbox("Question 4 - What did one computer say to the other?")
q5=inputbox("Question 5 - Why did the chicken cross the road?")
msgbox("Answers!")
msgbox("Q1 - How many days are there in a leap Year?, you answered ") + q1 + (" ,the correct answer is 366")
msgbox("Q2 - How many Suns does Neptune have?, you answered ") + q2 + (" ,the correct answere is one, our sun.")
msgbox("Q3 - What is your name?, you answered ") + q3 + (", the correct answer is ") + name + (" or is it?")
msgbox("Q4 - What did one computer say to the other?, you answered ") + q4 + (", the correct answer is, 011100110111010101110000 (Binary code for sup)")
msgbox("Q5 - Why did the chicken cross the road?, you answered ") + q5 + (", the correct answer is To get to the other side")
msgbox("Well done, ") + name + (" you have completed the quiz")

Getting curent time of specific time zone in classical asp

Here goes the problem:
I have a requirement that an (classical)asp application should display different content at specific EST(Eastern Time) duration. The clients can arrive from any timezone, but the server should take only EST time into consideration.
I am sorry for my ignorance, but I am from ASP.Net background and have no idea of doing this in classical asp.
This SO Link guided me to get UTC, but I still don't know how to convert it to EST.
Any help will be greatly appreciated.
If your server is in EST then not an issue, otherwise you'll need to compensate for it.
mytime = now()
myadjtime = DateAdd("h", 3, mytime)
will add 3 hours to the current time
<%
mytime = now()
response.write hour(mytime)
if hour(mytime) >=12 then
response.write "It's noon or later"
end if
%>
you can check http://worldclockapi.com web site. You can take current time as timezone..
example: http://worldclockapi.com/api/json/est/now
if you go to above address you can see EST current date, time and other data..
example: http://worldclockapi.com/api/json/pst/now
if you go to above address, you can see PST current date, time and other data...
and you can use XMLHTTP for getting data from external site.
`
private Function GETHTTP(adres)
Set StrHTTP = Server.CreateObject("Microsoft.XMLHTTP" )
StrHTTP.Open "GET" , adres, false
StrHTTP.sEnd
GETHTTP = StrHTTP.Responsetext
Set StrHTTP = Nothing
End Function
full_data= GETHTTP("http://worldclockapi.com/api/json/est/now")
`
after you use split code by comma:
parts=split(full_data,",")
response.write parts(1)

visual basic difference in dates between two lines in text file

I am new to vb express and looking for a way to read two lines in a text file get the difference between then and loop it till the end its a simple clock in clock out system which store each persons clock on and off time in a text file like so
03/11/2014 09:55:02
03/11/2014 14:55:02
03/11/2014 16:55:02
03/11/2014 19:55:02
04/11/2014 09:00:02
04/11/2014 13:00:00
I know I use the DateDiff to get the time but I only want them to work out the difference between line 1 and 2 then 3 and 4 and add them all up is it possible to do that without over complicating things?
I guys I have worked it out I have done this by reading the text filed line by line in a loop at the moment I have not put any validation in to show people who have forgot but the basics are there
Dim FILE_NAME As String = "times\08.txt"
Dim start As DateTime
Dim finish As DateTime
Dim total
If System.IO.File.Exists(FILE_NAME) = True Then
Dim objReader As New System.IO.StreamReader(FILE_NAME)
Do While objReader.Peek() <> -1
start = objReader.ReadLine() & vbNewLine
finish = objReader.ReadLine() & vbNewLine
duration = DateDiff(DateInterval.Minute, start, finish)
total = duration + total
Loop
Label2.Text = total

Having the day value of date start with 0

I am editing a VBScript so it will take yesterdays date add a string to the front off it and search for that file before moving it to a folder.
sDate = day(date)-1
sName= "Blaa" & "_" & sDate
Using the above bits of code I would get a result - Blaa_10 or Blaa_9
The issue is the files, I want it to search for when under 10 would be named as Blaa_09.
Is there anyway I can format the value day so when it is under 10 it starts with 0? Think I could write an If statement to do this but was hoping there is another way.
The canonical way to left-pad a day of month with a zero in VBScript looks like this:
Right("0" & Day(Date), 2)
Just went with
sDay = day(date) -1
IF sDay < 10 Then
sDate = "0"& sDay & monthname(month(DateAdd("m",-1,Date)), True) & year(date)
WScript.Echo "Date = " & sDate
This worked fine, if anyone has an easier way please feel free to share.

Resources