Convert Excel query to Dax measure - excel

Could you help me with DAX calculation for :
=IF(C11=0,"- ",(C21+C26)/C11)
CONDITION
,this is an excel calculation i want same calculation in DAX,Power BI
as per above image

The data isn't structured like a table in power bi. First structure your data into a normalized table format.
Which would your columns will be
Product category Amount
If you have a way to explain your logic that would help. If you write out your logic then maybe that would clarify what you need
To get the answer you want, you will need to do some filtered measures on based off of the product category once you normalize the data. I suggest adding it to power bi and giving it a shot

Related

Excel Data Model not detecting relationships

I am struggling to get this simple data model to work in Excel's Data Model. I have 3 tables. One table is a large budget. The second table is a small budget. The last table is transactions. Each transaction is allocated to both a small budget and a large budget. I think my issue is because we can't use bi direction filtering with Excel's Data Model. When I try to use a field from the transaction table, there is no relationship to any of the budget table. Is there another way to set this up?
Please see pictures attached. Thanks!!!
You're correct that bi-directional filtering is not an option in Power Pivot, and so filtering only ever propagates from the one side to the many side. Which, in your case, means that the Transaction table cannot filter either of the other two tables.
Have you tried adding Calculated Columns to the Transactions table to pull in the Big Budget and Small Budget Values? For example, for Big Budget Value:
=
LOOKUPVALUE(
BigBudget[Big Budget Value],
BigBudget[Big Budget], 'Transaction'[Big Budget]
)
I got it I think. You can use the CROSSFILTER measure.
=CALCULATE([Sum of Big Budget Value],CROSSFILTER(BigBudget[Big Budget],'Transaction'[Big Budget],Both))

Correlation Matrix for monthly return streams in Tableau

Can someone help me create this same thing in Tableau? I am trying to do it for about 20 different stocks. I would appreciate help!
You can read about the CORR() and COVAR() aggregate functions in the Tableau Documentation There are also table calculation versions WINDOW_CORR() and WINDOW_COVAR()
To be effective with them, read about the differences between aggregate calculations and table calcs also. One hint, aggregate calculations are performed by the data source (say Postgres or Oracle), table calculations are performed by the client (say Tableau) taking the aggregate query results as input.

How to get value from nested relations in Power Pivot?

I'm using Power Pivot add-in to create a data warehouse for generate dynamic tables and graphs (strictly data source is Excel), but I have a problem whit a calculate in the relations. My data model is the following:
My Snowflake data warehouse model
So for the fact table "fSales" I need to multiply the dCostDetail[Value] per dWorkCost[Value] to generate the fSales[Expenses] amount.
I tried to use the formula but I get an error: related but it don't allow to nested between the relations, e.g. fSales[Expenses] = related(dCostDetail[Value])*related(dWorkCost[Value])
Also I tried to use the next formula:
fSales[Expenses] = related(dWorkCost[Value]) * Calculate(Calculate(Calculate(Value(dCostDetail[Value]), Userelationship(fSales[IdProduct],dProduct[Sku]),Userelationships(dProduct[IdCateg],dCategory[IdCategory]), Userelationships(dCategory[IdCategory],dCostDetail[IdCateg]))))
And I need this "type" of normalized model to have the details when I analyze the information, e.g. filter, but if you know another way to generate the calculation it would be ok.
RELATED doesn't work in measures, because it evaluates on a record-by-record level. So you're on the right track, but what you need to do is create a column in Powerpivot in the fSales table called "Cost Detail" or whatever, and use a RELATED formula there to pull in that value from the CostDetail table. Create another column and do the same thing to pull in the dWorkCost value into the fSales table.
Then you can do a measure for the expenses like this:
Expenses:=SUM([whatever you called CostDetailColumn])*SUM([whatever you called WorkCostColumn])
You should be able to drop that measure into a pivot and it should do what you're looking for.

Grand total on a SSAS driven pivot table

We are using a SASS SSAS driven pilot table where we would like to add a calculated measure using the sum of a column.
We don't know in advance which filters the users will be using, the measure is valid for any of them, so we just tried adding a calc measure on the excel file such as
[Measures].[Sales]/sum(axis(1),[Measures].[Sales])
But it doesn't seem to work. So just to test we started with a plain
sum(axis(1),[Measures].[Sales])
which gives some astonishing result.
We cannot figure out what the result is adding up! Applying some filters and a detailed row, we get exactly twice the expected value (!!??).
Applying exactly the same filters and filtering also the rows, we get a value that we are not able to guess where it comes from.
Any idea about what MDX should we use?
Edited to clarify: We want to add the calculated measure on an Excel pivot table, not on the SSAS olap cube definition.
I obviously was having a bad day. One cannot think excel-like to solve an mdx issue.
A simple
([MyDim].[MyHierarchy].currentmember.parent,[Measures].[Sales])
is the right syntax to use in our calculus as the "parent total".
Thks

PowerPivot to list data values instead of summarising

Just starting with MS PowerPivot. I am trying to create a pivot showing the list of responses to questions in a survey, but am falling over where the powerpivot wants a 'Summarize by' value for the pivoted responses.
In a sql query to return these data I would use max(AnswerComment) (as there will only be one answer per respondent per question). However, when I select Max as the Summarize by values, PowerPivot returns: ERROR - CALCULATION ABORTED: Calculation error in measure 'Answer'[Maximum of AnswerComment]' and then explains that only numbers or dates (and not Strings) can be 'MAX'ed.
Is there a way of listing pivoted data (rather than performing a summary calculation on it)? If not, is there a summary function that PowerPivot accepts for string types?
thx
mcalex
By definition, PowerPivot doesn't let you list text values out. The way to workaround this is to place the column onto a row and then make sure you have another measure that includes all values of that column (traditionally dimension).
Saying this, a common approach is to build a Power View report on top of your PowerPivot workbook. This will allow you to list the values.

Resources