How to solve Error Out of present Range in Power BI (DAX formula) - string-formatting

I have tried to fix the out of present range problem in Power Bi Dax formula
General background
I have a data-set as below, the dashboard allows the user to select the preferred currency and then the table update the value. For example, if click on the US, then the table sum all Sales in Jan from the US
as well as showing $ or € accordingly
The DAX function I have tried is
CONCATENATE( Table[Country]="US", "$",FORMAT(sum(Table[Sales]),"0")
but it comes up with below error
Couldn't load the data for this visual
The following system error occurred: Out of present range
Any help, please. thanks

You don't need to use any concatenation. You can simply put the currency symbol in the FORMAT function. For example:
Measure = SWITCH(SELECTEDVALUE(Table[Country]),
"EUR", FORMAT(SUM(Table[Sales]), "€0.00"),
"US", FORMAT(SUM(Table[Sales]), "$0.00"),
"UK", FORMAT(SUM(Table[Sales]), "£0.00"))

Related

number of months between two dates in salesforce

I have a report in Salesforce that contains an Estimated Start Date and Estimated End Date - see below example:
What I want to do is create a formula column that will allow me to show how many months are between those dates.
I can do this easily in excel using DATEDIF but cannot replicate that in the salesforce report itself - see below example of desired result using DATEDIF in excel:
Can anyone advise on the easiest way to achieve this result as a formula column in Salesforce?
Many thanks
I did this by creating a field with the below formula
((CloseDate - Estimated_Start_Date__c) /(365/12))

Duplicated dates POWER BI

I am new in Power BI, and I am struggling with how to resolve an issue.
I made measures to calculate my total feedback. The feedback column can be POS, NEG, and Neutral. The overall sentiment I calculated by taking pos feedback and dividing by all feedback.
totalFeedback = CALCULATE(COUNTROWS('feeback'),'feedback'[sentiment] = "POS")/ COUNTA('feedback'[sentiment])
Now when I want to calculate the difference between two months. Example today's, and last month I get an error saying duplicates dates.
difference = CALCULATE([totalFeedback], DATEADD(FILTER('comment'[created_at], 'comment'[created_at] < TODAY()),-1,MONTH)
I get an error saying: A date column containing duplicate dates was specified in the call to function 'DATEADD'. This is not supported
What I did was I created a DATE TABLE and made a relationship with the comment[created_at].
DimDate= CALENDARAUTO(12).
Now, I don't get the error anymore, but non of the data is shown when adding the measure in the table.
I need advice, thanks

Google Data Studio : how to obtain a SUM related to a COUNT_DISTINCT?

I have a dataset including 3 columns :
ID transac (The unique ID of the transaction - Dimension)
Source (The source of the transaction - Dimension)
Amount € (The amount of the transaction - Stat)
screenshot of my dataset
To Count the number of transactions (for one or more sources), i use COUNT_DISTINCT function
I want to make the sum of the transactions amounts (for one or more sources). But i don't want to additionate the amounts of the transactions with the same ID !
Is there a way to do this calcul with a DataStudio function ?
Thanks for your answers. :-)
EDIT : I saw that we could do this type of calculation via SQL here and I would like to do this in DataStudio (so that I don't have to pre-calculate the amounts per source.)
IMO, your dataset contains wrong data. Each value should be relative only to that line, but this is not the case: if the total is =20, each line should describe the participation of that line to the total. With 4 sources, each line should be =5 or something else that sums 20.
To solve it in DataStudio, you need something like CALCULATE function in PowerBI, but currently DataStudio doesn't support this feature.
But there are some options to consider to repair your data:
If you're sure there are always 4 sources, just create a new calculated field with the expression Amount/4 and SUM it. It is not an elegant solution, but it works.
If your data source is Google Sheets, you can easily repair the data using formulas, like in this example:
Link to spreadsheet
For this spreadsheet, I used this formula in adjusted_amount column: =C2/COUNTIF(A:A,A2). With this column in DataStudio, just use the usual SUM aggregation function to summarize it correctly.

How do I calculate the percentage of a count function?

I am trying to take the percentage of a count function so to create a MS BIDS report resembling this excel file:
Excel Close Rate Summary
The unique identifier for the opportunities is the field "opportunityid", so I am using COUNT(Fields!opportunityid.Value) to determine the number of cases in each stage. I want to write an expression that will return the percentage of cases in each stage per creation month. Which can be seen in the above excel screenshot.
This is my current MS BIDS report when i preview it
To be more specific, I want to have the percentage of "Active" and "New" opportunities in January to represent 67% and 33% respectively. 67% comes from 4/6. The 4 comes from the active opportunities out of the 6 opportunities created in January. Likewise, the 33% comes from the 2 new opportunities out of the 6 that were created in January.
There are more stage names than Active and New. Other options include New, Warm, Hot, Implementation, Active, Hibernate or Canceled. This is relevant to mention because I have tried to create an expression that counts based on the number of opportunities with a specific stage name, but have been unsuccessful.
Currently the expression I am using to calculate the percentage is:
=COUNT(Fields!new_rptstage.Value)/SUM(COUNT(Fields!opportunityid.Value),"GroupbyStageName")
Based on this expression, I am only able to get 1/1 or 100% for each of the stage names. I have tried a bunch of variations of the above expression by changing the scope, but have been unsuccessful in getting the desired results. Can someone explain how to correct this?
SAMPLE DATA:
In the sample data, I want the expression to be in the percentage column. The percentage should be the # of cases in a particular stage for the total cases that month. So looking at the above picture:
Active February 54 54/168 [have 54/168 display as a percentage]
Warm February 8 8/168
etc.
EDIT:
These are the expressions that may help show the underlying data in the chart.
The creation month expression is
=Fields!MonthCreated.Value & " " & year(Fields!createdon.Value)
The percent expression is listed above.
You don't want to use the COUNT() function. COUNT(*) returns a count of the number of rows that have a value. It doesn't return the actual value.
Since you've only showed a screen shot of your report, I don't know how your underlying data columns relate to it, but what you want to do for your Percent column expression is this:
This is psuedo code because I don't know your dataset field names:
CaseCount.Value / SUM(CaseCount.Value)
EDIT: Now that I better understand how your data relates to your report, I think the only change you need to make to your existing formula is casting it to a decimal type. It's probably rounding all fractions up to 1.
Try this for the expression in your percentage column:
=CDbl(COUNT(Fields!new_rptstage.Value))/CDbl(SUM(COUNT(Fields!opportunityid.Value),"GroupbyStageName"))

Reporting Services Chart - Hard Coded Series

I am developing an SSRS 2008 report which contains a number of simple charts. On the x axis I have the 12 months of this year - Jan 2009 thru December 2009. On the Y is an integer value ranging from 0 to 100 in increments of 10. I am plotting the number of times an issue occurred per month. So January could have a value of 10, February 30, etc. etc.
I would like to have a horizontal line/series that is constant and shows the yearly average for 2008. So, say the average was 30 issues per month in 2008, I would like for that line to be shown in my chart. Basically, I want to draw a straight line across the chart for that value... I can see how to add more complex series, but this seemingly simple task is getting the better of me.
Doe anyone have any idea how this could be accomplished?
Thanks in advance,
Jason
[Update] To add some further details, I am already pulling the average for each row in my dataset and have it set up as its own series. However, rather than plotting a line, this approach plots individual points for each month. While this is close to what I want, I need to join the dots so to speak. The chart is of the Error Bar (Range) variety.
Can you use a column / line hybrid chart? If so then add a constant or dynamic target value to the chart:
Design the chart.
On the Data tab in the Chart Properties dialog box, add a new data value (for example, Target).
Set the target value (see the example in Figure 9 on link this uses a constant target value of 100000 across all categories but you can do it dynamically too). Make sure to use an expression starting with = (equals). Otherwise, the value is not interpreted as a numeric value.
See the example on the MS charts page at http://msdn.microsoft.com/en-us/library/aa964128.aspx
Add the yearly average to each row in the underlying the query. Add data series on just that value.
I managed to solve this issue myself.
As I mentioned, I was using an Error Bar graph. Right-clicking on the series of interest, I was able to change the graph type for that particular series - essentially leaving me with a chart with multiple graphs in it...particularly simple if you know where to look - which i did not! Thanks everyone for your suggestions.

Resources