We have an SSAS OLAP cube, in production since long and perfectly tested by dozens of users, with a normal Time dimension (two hierarchies, Months and Weeks, but this is irrelevant).
The Time dimension key is a date field. On the data view it is defined as DataType: System.DataTime. On the dimension as Calendar -> Date, Usage: Key.
Using this date field on an Excel table accessing the OLAP cube is fully operational, it is a date and "Date filter" options are available as expected.
But trying to use this field on PowerBI defeated all our efforts! No way to have PowerBI interpret the field as a date, so no date filters are available. PowerBI thinks it's a text field and nothing we can think makes it change its behaviour.
We tested PowerBI with an external Excel and adding the SSAS OLAP dimension so to be able to modify the field format and oh surprise! the field is interpreted as text. Changing the format to date makes it work.
But there is no way to change the format for an SSAS OLAP cube when accessed directly as the primary (and only) source of data for the PowerBI repport.
Any idea how to define an SSAS OLAP date field so PowerBI understands it is a date?
Found it! One minute before getting mad forever I spotted the diference.
I was able to create two dimensions on the same cube, with the same field. One works, the other doesn't.
Define the date field as Order by Key and PowerBi treats it as a date.
Define the date field as Order by Name and PowerBi treats it as text.
I came across same situation. I don't know OP's calendar dimension properties, but his solution does not helped me.
In dimension design I used ValueColumn property
And in Power BI I saw a new field, that worked pretty nice with Slicer visual:
And Excel all remained the same:
Related
I'm already struggling for days to use dates from excel in a proper way in anylogic..
I've created a database in where the date is formulated as integers in different columns since otherwise excel is messing up the dates (for example year=2021 , month=12 day=5 hour=6 minute=44 second=0 stands for 2021/12/5 6:44:00)
Now I know this can be converted to a date by the function toDate(year, month, day, hour, minutes seconds). But how can I use this integers to create agent with specific parameters from the database in a source and add to a custom population?
The most simple way is to add a column where the function toDate(......) is added in the database but I do not know how to do this (see picture if it is unclear). Or are there other solutions?
One way: use Dynamic Events.
Create one and in the action code, write mySource.inject(1)
In Main, on startup, load all dbase rows and create a DE for each row, below assuming it is only with an hour-column:
(Use the database query wizard to adjust your query).
In your source object, set it to "call of inject() function"
This will work, but it is quite cumbersome, as you can see. Much easier if you get your Excel right and just import the date column clean and well so you can use the Source option "arrival table in database" directly. I know you need regular arrivals, so maybe code that up in Excel to give you these on specific dates...
I am trying to convert some measures that I have into dates for making a line chart. This is the data I have.
[
I am trying to make a line chart out of this data. But I cannot put it under a date since there are no dates in the dimensions. Any help would be appreciated.
You will need to some how reshape this data to create a single date field. You can do that out of Tableau or perhaps use Tableau prep. Your underlying data source is likely to drive that decision, you don't mention anything about that in your question.
Edit from comments:
Connect to the spreadsheet in Tableau. In the Data Source window, where it shows you all of the data in a table, select the 4 fields starting with Tuition and Fees. Then click on the drop down and Pivot those fields.
That will create 2 new fields, Pivot Field Names and Pivot Field Values.
In your workbook create 2 new calculated fields:
[FeeYear]: LEFT(RIGHT([Pivot Field Names],7),4)
and
[FeeDate]: MAKEDATE(INT([FeeYear]),1,1)
You can use FeeDate as the x axis of your line chart. Pivot Field Values is the measure to use in your line chart.
I have a "Range of Dates" filter and what I want is for the max (or right most value) to always be the most recent date which should be today's date. What seems to be happening is that if I leave the dashboard open and come back the next day the max value is yesterday's date and I must manually move the slider over to be today's date. How can I accomplish this?
I find a calculated field is the best way to do this as I have run into the same issues using the out of the box max date filter.
Create a calculated field as follows:
[date] = {FIXED: max([date])}
This creates a True False field where only the records that have the max data and carried through.
Now drag this onto the filter pane and select 'TRUE'.
I've generally seen two basic approaches for this problem: Calculated fields and relative dates.
Use a calculated field or parameter or some combination of calculated fields and parameters with filters. This is similar to what smb suggests in their answer to this question. It also seems to be the most popular approach.
If you don't particularly care about being able to set the end-date with the slider, you could try using relative dates, using the approaches detailed in the accepted answer to this Tableau forum question and in this Tableau Knowledge Base article. Jennifer Vonhagel also gives a second answer to the Tableau forum question farther down that uses a parameter plus calculated field approach.
Additionally, this Tableau Knowledge Base article offers another option (Option 1, in the article) if you have Tableau 10.3+: You can use the "Latest Date Preset" (see here for details) check box in the date filter dialog box. I haven't used this, but it looks promising if you're using Tableau Desktop (seems like it wouldn't work for Tableau Web). The article's Options 2-4 are just riffs on calculated fields, in my opinion.
Two more approaches I've heard of – but never personally seen in the wild:
Push the max date down into the view you put Tableau on top of and let the view do the work.
Use a script to modify the Tableau workbook's XML.
I am using Power BI in my current project for making charts. My data source is Azure SQL database.
I would like a table chart to display today and yesterday data only, for which i used advanced filtering by setting the filter to today and yesterday dates. However, I want to be able to open my report tomorrow and see charts use data from tomorrow and today respectively.
With advanced filtering the charts appear static, not dynamic.
It would be good if someone could explain how to write queries in Power BI on my tables.
You could either
1) modify your sql query to only return today and yesterday data
or
2) add a calculated boolean column, something along the lines of
"IsCurrent = IF(AND(DATEVALUE(Table1[Date])<=TODAY() , 1.0*(DATEVALUE(Table1[Date])-TODAY())<=2),True,False)"
Then filter by IsCurrent.
Using the SDK you can apply filter(s) dynamically to the report. This allows you to simulate the user filtering the report data to the current day and yesterday.
Your client app would compute the correct filter data values and apply it to the report. Using something like report.setFilters(filters)
See this related question for more information about filters:
Power BI Embed URL-multiple filters
I have issue trying to filter in excel 2010 pivot table on date attributes from a Cube source.
My problem is i have Date attributes in NONE date dimensions my example is a Asset Dimension that has a set of date attributes like:
Bought date
Sold Date
Repair Date
Is there a way to set these attributes to type date so pivot table will directly identify them and allow use of Date Filters ?
Or do i have to create a Date dimension for each attribute and user will have to select which Dimension he wants to slice data by
One option is to add an additional date "role-playing" dimension to the cube (e.g. DimAssetBoughtDate) and hang it off the fact tables using a reference-relationship through the Asset dimension. This not only provides you with the date-based filtering but also all of the built in hierarchies. Plus date dims are usually pretty small so materializing the relationship shouldn't be an issue.
Note: you may need to add a calculated member to your Asset dimension in your DSV to convert the date value (e.g. AssetBoughtDate 3/12/2015) to the date-key value (e.g. AssetBoughtDateKey 20150312) in order to properly add the new DimAssetBoughtDate.