Is there a way to convert this MDX syntax to DAX? - ssas

I'm changing a legacy multidimensional analysis services to tabular and "Converting" the MDX measures to DAX. (I don't have much knowledge using MDX)
I found the script below and i'm not sure what it is doing.
([Origin].[Origin].&[BUDGET FILE],[Measures].[Value])
I think it's is using the Column Value inside the Budget file located in the Origin to fill or create something in the measures.
So, first can anyone help me understand what this code is doing?
And second, would DAX support such thing?
Thanks!

Here is the equivalent assuming the Value measure is a Sum.
CALCULATE(SUM(YourTableName[Value]), 'Origin'[Origin]="BUDGET FILE")

Related

MS Access - Age of record calculated field

I am new to Access but I have experience with Excel and Power BI. I could use a little help with what is probably a very simple problem for most of you.
I searched for a simple solution to this same problem quite extensively before posting here. I tried adapting solutions for similar problems to my problem, but I'm just not familiar enough with Access yet to bridge that gap.
I have a [request date] field. I want my [age] field to return the number of days since that request date. Sounds simple enough. o_O
Through trial and error I eventually determined that I cannot do this without a query (please prove me wrong?). And why can't I use datediff() or date() in a calculated field, anyway? Grr.
So I set up an update query for a new field (called [today]) with the expression "date()".
Then I set the [age] field to be calculated with the expression [today]-[request date].
This gives me the result I want for [age]. But now I'm thinking I need to write an autoexec macro to run this query every time the database is opened so that [today] stays current.
At this point I stopped. Seems like a lot of work for such a simple problem. I hate being inefficient. I'm hoping someone out there knows a more elegant solution that might also teach me some new tricks, too.
Thank you in advance for your help!
Calculated fields belong in queries, not tables.
Just use a SELECT query. It could be as simple as
SELECT *, DateDiff("d",[request date],Date()) AS Age
FROM yourTable
and then use that query wherever you would use the table.

ISLEAF and IIF MDX to DAX

I am currently working on migration of SSAS cube from Multidimensional to Tabular. I have many MDX queries.
For example:
IIF(IsLeaf([Currency].[Currency]),[Measures].[_Discount],null)
I was trying to understand, the above query with some data examples but no luck.
What is the above query mean in MDX?
How could I possibly write this in DAX?
Any help is really appreciated.
Thanks in advance.
Assuming your Currency hierarchy is just one level try:
IF(ISFILTERED(‘Currency’[Currency],[_Discount])

SAP HANA Calculate percentage in a script calculation view

I was wondering if there was a way to achieve this kind of aggregation :
In practice: using (I think) CE_AGGREGATION how is possible to create a percentage formula like the one in "calculated column"?
I try a lot of combination (CE_PROJECTION,CE_AGGREGATION, CE_CALC...) but no ones of them works.
This because it seems that the script do a kind of sum(A/b*100), but I would like to obtain sum(a)/sum(b)*100. In graphical mode is instead very simple!
Someone has an idea about how to reproduce that?
Really, don't bother using the CE_-functions anymore.
Use SQL instead.
This is not only much easier but also SAP HANA has more options to rewrite and optimize the statements internally.
This should then lead to more options for better performance.
Anyhow, to do calculations like that, there is the CE_CALC function, that you can use within a CE_PROJECTION function.
Again: stop using CE_-functions. SQL is King!

MDX IN Or SubQuery

I am making a sales cube for a bank, I need to do a query with this Dimensions DimTiempo, DimCliente, DimCuenta
I need to find the number of customers who are in DimCuenta attribute [DimCuenta].[Planes].[Cue Nombre Plan] with value 'APORTES SOCIALES' And besides having another record in the DimCuenta with the attribute [DimCuenta].[Cue Codigo Aplicacion] with value 'L' also need to include in the result hierarchy [Ano Mes] of DimTiempo, I don't know to do this because I Don't know how to do an In or a subquery in MDX,
The best advise would be to take some time and read about MDX technology. There are a few principles that are different and need to be known.
I'd advise reading some introductions in MDX as this one. If you're more a reader there are some books on MDX. Sorry, long time I haven't read one can't advise.

Passing MDX parameters to SQL query

I have several reports that are from SSAS 2008, but one of them has to drill through to a SQL Server report simply because the data is far to granular for a cube.
Any tips on passing parameters? Of course they are passed in as MDX, and I can't figure out a way to get just the "Key" with the source MDX. Surprisingly I can't find a lot of pointers on this.
Let me know if this is too vague...
Are you getting the MDX passed in as a string which you can examine and fiddle with? If you can extract the dimension and member name, you could look up the name in the SQL database to find the ID required, which could then be passed on?
I assume you are getting strings like this:
[Location].[All location].[South].[Surrey].[Guildford]
If you look up 'Guildford' in your SQL db you'll be able to find out it is row 2134 and that's what you need?
I'm assuming that you want to call this report from a report action. If your attribute has a single column key you can reference it using something like:
[<dimension>].[<hierarchy>].CurrentMember.Properties("MEMBER_KEY")
If your attribute has multiple key columns you would use KEY0, KEY1, etc to reference the individual parts instead of MEMBER_KEY