SSRS 2012 total of a percentage measure - ssrs-2012

I have a percentage measure calculated in SSAS tabular and its correct.
But when i use it in a report i face the following problem (in all percentage measures).
the values under male and female (which are subgroup of saudi and non-saudi) are correct but if you look at the total under "Both sexes" it is incorrect,because it shows summation of male and female percentage, where the right thing is it shows the percentage of the saudi or non-saudi.
If i calculate the measure in SSRS in the expression fields i get it right as follows
But i want to use the measure to show the right values.
So.. can anyone help me with this i have serious issues in later reports and i just cant simply recalculate the SSAS measures in SSRS using expressions.
Note: dont mind the decimal places differences between the two pics.
Thank you.

You can change your MDX query in SSRS to return the subtotal rows then change your Textbox formulas in the body of the Report to say =Aggregate instead of =Sum. This process is described more here by Stacia. You can use manual MDX queries. Don't miss the comment at the bottom:
Romuald Coutaud March 17, 2011 at 7:52 pm Hi Stacia,
In fact, it works in query mode too in 2008R2. But, I have to admit
that the way that RS and AS work together when you want to use
aggregate function is very difficult to perfectly understand and I
have struggle very long time to make one sample report running in this
way. In query mode you need to write MDX by referencing each level of
the hierarchies from the top one to the deepest one want to display in
your report, even you don’t need to use all these ones. As an example
you have to put Year, Quarter and Month to be sure to display Month
and be able to use aggregate function.
Basically in your report =Aggregate will try to retrieve a row where Nationality is not null and Gender is null. If you get stuck please write back with the list of each field used in each group in SSRS and a screenshot of the MDX query designer.

Related

DAX ignore row context in measure. Calculate for a defined set of dates and show the value for all dates in visual

I am trying to create a measure which calculates the average daily revenue per customer, but only using days in a 6 months period prior to a specific date (where some type of conversion happens).
This specific date can be different for each customer.
The intention is to use the measure as a baseline for indexing daily average in the days/months/years after said conversion date.
If I put my current version of the measure in a card it works just fine (circled in green). But I will eventually have to visualize this over time as well. Thus I need the value to stay the same regardless of the row/date context in a table or timeline (circled in orange).
I suspect I need to use one of the ALL/ALLSELECTED/ALLEXCEPT filter modifiers but I can't really get anything to work.
The measure looks like this for now:
Average daily rev before conversion = CALCULATE (
AVERAGEX(
VALUES('Date'[Date]),
[HI & Acc Rev]
),
FILTER('poc vFact_SalesLine','poc vFact_SalesLine'[OrderDate_ID] IN DATESINPERIOD('Date'[Date],FIRSTNONBLANK('poc vDim_Customer'[DSE first conversion date],1),-6,MONTH)))
I've tried adding REMOVEFILTERS('Date'[Date]) just before the filtering of order dates, but that doesn't work. Gives me the exact same values as shown below.
All help is very welcome? Is my approach all wrong?

Can you remove drill through filter from measures in Power BI?

I am trying to use the drill through filter to take my user to other data related to that date. Essentially I have an overview page and I want the user to click on a date and drill through to the next page, where it will show them test scores nearest to that date.
I think I need to do two things 1) store the filter date as a variable so I can use it to find the nearest test date to the filtered date 2) create measures which ignore the filtered drill through date and can for example calculate the minimum or maximum test scores on all the tests overall.
I'm not sure if either of these options are possible but any help is greatly appreciated. TIA

Is it possible to use a dynamic value in a DAX formula?

I'm working on a BI project with Visual Studio and Power BI.
I get the sales of several stores and in Visual Studio I made a column calculated with the following formula :
=
SWITCH (
TRUE(),
Y2_Sales' [storename] = "UK-RC O/O NEWQUAY", Y2_Sales [SalesExGST] / 0.8564058469475494,
'Y2_Sales' [SalesExGST]
)
To explain I get the sales in GBP and as soon as the store is Newquay I convert these values into euros to display them in my Power BI report.
The problem is that the value I put in hard is a value that moves every week, you can find it here :
https://www.xe.com/fr/currencycharts/?from=EUR&to=GBP&view=1D
Is it possible to modify this value dynamically by having historical exchange rates?
I don't quite understand why you want a calculated column, wouldn't a measure for euros be easier? Then you could declare your change rate as another measure and make the whole thing dynamic. You may need to use a disconnected table and selected measures to get the result you want, have a look at sumproduct for that https://www.sumproduct.com/blog/article/power-pivot-principles/ppp-variables-and-disconnected-tables-in-power-bi it looks like you're most of the way there, just lose the calculated column and go all measure!

SSRS Matrix Variance Column - Report Running Slowly

I am creating an SSRS Report based on a Stored Procedure; the procedure calls in the last six months of data based on the month the user enters into a parameter (ex. 201604). Currently I have this data going into a matrix, and along with those six months the report needs to have a variance column for the latest vs. directly prior month (ex. 201604 vs. 201603)
Right now I have a formula that works using a column that I created within the stored procedure to designate whether the month a row is in is CURRENT, PRIOR, or NONE if it is not being used in the calculation.
=SUM(IIF(Fields!VarHelper.Value = "CURRENT",1,0) * Fields!stock_value.Value
-
IIF(Fields!VarHelper.Value = "PRIOR",1,0) * Fields!stock_value.Value)
I am using this formula in three areas/cells on the report, and for some reason it is causing the report to run very slowly (around 45 seconds to run). Without these variance formulas in the report it runs almost instantaneously.
Would someone be able to either a).suggest a better method of calculating the variance between the latest two months in a matrix, or b).be able to at least shed some light on why this may be impacting report performance?
Thank you in advance!
Try to report the calculations on the query.
Two ways possible : if you made a sql query : make it in the select.
Or, add calculted field in the dataset.
And make sum on these fields.
May be you will win time : because the database server will make the job instead of the report server.

Calculate Value For Dates Between

A few references:
Microsoft's documentation on DATESBETWEEN.
Somewhat similar question, though the answer and derivatives of the formula don't return the correct results.
Microsoft's documentation on TODAY
Per the above Microsoft documentation, I'm trying to get a calculation for the last three months based on today's current date in SSAS Tabular model. First, I have no idea how to use SSAS and my company doesn't provide any learning material, so I've been reading through the MSDN documentation, which may not be the place to start, so if this is wrong, I'd appreciate being told so. For instance, with C# or Ruby, I can test code in a console to see if I get the result that I want, and I don't see how I can do that in SSAS Data Tools' DAX language - this is a GUI which gives users very little power over what they can do (it took me four hours to figure out how to access a dimension's properties). I am definitely a code monkey.
I tried using the below formula (and derivatives of it) because this is what it looks like Microsoft is doing in their example:
3MonthValue:=CALCULATE(SUM([MeasureOne])/SUM([MeasureTwo]),DATESBETWEEN(DateDimension[Date],DATEADD(DateDimension[Date],-3,MONTH),TODAY()))
The result, nothing. Of course, if I run similar SQL logic, I get the right results. I also used the provided SO example, though I suspect that's not exactly what I'm trying to achieve, and only obtained blanks as answers. Given that I need to calculate a formula between a certain time frame, which in SQL would be the WHERE clause, how do I translate this into DAX? In other words, what is DAX's WHERE and if CALCULATE isn't right, what's the correct approach?
When you say it isn't working, how do you mean? The formula you are using refers to your date dimension's key as the starting date for your DATESBETWEEN function - this means if you are expecting the measure to populate a value, you'll need to be using a particular date in your pivot to establish context.
If you are trying to view the measure at design time, in the editor, there is no context so the measure wont populate.
Moreover, if in a pivot you're looking at a time context that includes more than one date, that also will not work. So say you are looking at a month, or a quarter. Both of these encompass what amount to multiple DateDimension[Date]'s - so again context cannot be established.
so to recap - measures which look at date ranges like DATESBETWEEN using a starting time context that is set to your dimensions time key will only show up in a pivot when the pivots data is filtered to a single date.
You can test this using the same function, but hard set the starting date by replacing DateDimension[Date] with a static date (or possibly TODAY()). The measure should show up in design time because the formula has all the information it needs to complete the calculation.

Resources