Explanation of the dataset I am using
I have a dataset containing the following values:
Timestamp
Value
Tag
The combination of a timestamp and a tag makes a row unique.
This dataset could, for example, make it possible to retrieve the value of tag A-A-A at 2019-05-20 00:00:00
Goal visualization (in Power BI)
The following image shows the visualization I would like to make in Power BI.
X-axis = Timestamp
Y1-axis = Value of Tag A-A-A
Y2-axis = Value of Tag B-B-B
Y3-axis = Value of tag C-C-C
Problem
I am unable to make a graph in Power BI that shows the Value of each Tag at a certain Timestamp.
I am curious how I can make Power BI understand that a Value corresponds to two values (Tag + Timestamp)
You should be able to achieve this by putting the Tag column in the Legend box as shown here:
Related
I am trying to create a column in Power BI to group the rows of that data on.
I want the column to output text based on a comparison of dates.
Example:
projected = if(staticdate1 > dynamicdate, "XX", if(staticdate1 < dynamicdate && staticdate2 > dynamicdate, "YY", .... )
The dynamicdate presumably would be a filter or slicer the user could click a date on, thus changing the output of the column, and the totals per output would also change.
Is this possible? I've tried SELECTEDVALUE() but that didn't work. I tried creating a "what-if" parameter and adding that to a static date, but that didn't change anything when I changed the parameter.
That’s not possible since calculated columns are static and don’t recalculate on filter changes. This works with measures only.
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).
I am trying to group my data based on the column "Type" and prepare a sankey chart with Country data.
The desire results is to have value by country for type - "MLA" and value for country for type "Sponsor". The tricky part is that there is a lot of duplicated information and it needs to be by unique ID.
You could look into potentially using the GROUPBY function:
https://learn.microsoft.com/en-us/dax/groupby-function-dax
You would add this to a blank table, and then it would create a summarised version of the original data table but summarised into the columns that you choose.
I have created two slicers in Power BI for Month and Year. These take the month and year value and in return generate a date.
Eg. Month - May & Year- 2019 generates 01/05/2019 with the help of the a measure formula :
MyFilterDate = DATE(SELECTEDVALUE(ListoY[Year]),SELECTEDVALUE(ListoM[Month],0),"01")
I want to subtract this date with one that is already in a column in the table.
I'm facing an issue when I try to subtract the measure from the existing column by writing DAX.
SUBVALNEW = DATEDIFF([MyFilterDate],Table[Date],DAY)
But when I try to do so, the result is not right. In fact when I try to check the value of [MyFilterDate] in the Data Model, it is not the same value as one calculated in the measure. (It instead looks like it displays the date in Table[Date])
Is there any way to subtract a Dynamically chosen date from a date in a column?
Any help would be appreciated.
I understand what your thinking patern is but power bi works a bit different. Dynamic measures cannot be used with calculated columns. When doing so the value of the measure is not set.
The way to go about this is by creating a Date table:
Date = CALENDAR(MIN(CalendarWeek[Date]);MAX(CalendarWeek[Date]))
Do NOT connect it to the model. From here you can make 2 slicers (based on the Date table). One your set to the month and the other to the year.
Next step is to adjust the MyFilterDate
MyFilterDate = DATE(SELECTEDVALUE('Date'[Date].[Year]);SELECTEDVALUE('Date'[Date].[MonthNo]);"01")
Make SUBVALNEW a measure (cannot be a column because it is dynamic!)
SUBVALNEW = DATEDIFF([MyFilterDate];SELECTEDVALUE(CalendarWeek[Date]) ;DAY)
Ass the Measuer to your visual, see end result below)
I'm trying to get a sum of my sales figures by the product category from the a column in the same table
The original data is on the attached image.
Original Data
And what I'm trying to get is attached also and I am having trouble getting the right numbers for the last three columns
Result
I have tried the following code:
Boots_Sales = CALCULATE( SUM(Sheet1[Sales]), FILTER(Sheet1,Sheet1[Product_Type]="Boots"))
I have found a solution to the above by making a measure instead of a column with the below formula:
boot1 = CALCULATE(SUM(original[Sales]),FILTER(original,original[Product type ]="Boots"))
This will have to do, I was trying to make a column because I wanted to do further calculations on the column but will just have to convert the measure into a column
Thanks