I am trying to replicate the below dax calculation which worked in Power BI but throwing error in SSAS tabular model.
Account Warranty Count = CALCULATE(COUNT(dds_repairlogs[Repair Logs]),RELATEDTABLE(dds_repairlogs),filter(dds_repairlogs,dds_repairlogs[Savings Type 2] = "Warranty"))
The error I get is count doesn't work with text fields. However the field Repair Logs in Count function is kind of uniqueidentifier. Does anyone have any suggestions on how to replicate the above measure in SSAS tabular model.
Adding a little to Olly's answer:
The COUNT function counts rows that contain Numbers, Dates, or Strings - but text values are only counted if they can be translated into a number.
Uniqueidentifier is not a supported data type in SSAS Tabular models, and therefore your uniqueidentifier values are most likely saved as Texts (i.e. Strings).
Changing COUNT(dds_repairlogs[Repair Logs]) to COUNTROWS(dds_repairlogs) in your formula should fix the issue. COUNTROWS counts all rows in a table, rather than numbers in a column.
The COUNT function only counts numbers. Your error message indicates the [Repair Logs] field contains non-numeric values.
Try replacing COUNT with COUNTROWS
Related
I am new to Power BI. I created two measures with two fields to be represented in percentage in chart. So I tired to pull those measures in the chart but it showed error. The tow measure that were created are:
`IgA% = CALCULATE(Count('Ig_Ops Referrals'[IgA]), FILTER('Ig_Ops Referrals,'Ig_Ops Referrals [Site]))
IgI% = CALCULATE(Count('Ig_Ops Referrals'[IgI]), FILTER('Ig_Ops Referrals','Ig_Ops Referrals'[Site_Lng_Des]))
`
It gives the error:
I am trying to represent two fields in percentage to created two measures for it and tried to use the chart visual, but it is not working?
You should use same data types columns, check if your column is both TEXT type
FILTER usage is wrong.
The syntax is - FILTER ( <Table>, <FilterExpression> ), where <FilterExpression> should evaluate to True/False.
You are asking DAX to interpret the text value of Ig_Ops Referrals [Site] as True/False. Those are not the same datatypes. Hence - the very clean and instructive error message.
In Power BI, I need to create a VLOOKUP alternative. From the research I've done, this is done with the LOOKUPVALUE function, but the problem is that function needs one specific SEARCH ITEM, which isn't super helpful in a VLOOKUP type scenario where you have a full column of values to search for?
Given these two tables, connected through the user_name and first_name columns:
...what's the formula needed in order to create a new column in the Employee_Table called phone_call_group by using the names as the search items in order to return the group they belong to? So how can I end up with this?
(Forget that the entries in each table are already sorted, needs to be dynamic). Will be back tomorrow to review solutions.
In Power BI you have relations between tables instead of Excel's VLOOKUP function.
In your case you just have to create a one-to-one relation between
'Phone_Call_Table'[user_name] and 'Employee_Table'['first_name]'
With that you can add a Calculated Column to your 'Employee_Table' using the following expression:
phone_call_group = RELATED(Phone_Call_Table[group])
and in the data view the table will look like this:
LOOKUPVALUE() is just a workaround if for other reasons you can't establish that relation. What you've been missing so far is that in a Calculated Column there is a Row Context which gives you exactly one value per row for the <search_value> (this is different from Measures):
alt_phone_call_group =
LOOKUPVALUE(
Phone_Call_Table[group],
Phone_Call_Table[user_name],
Employee_Table[first_name]
)
I have a table with two choices 'FLOW_CONTEXT' and 'TEST_NAME'.
I want to let the user select one of these values using a slicer. I then want to have a calculated formula point to either the 'FLOW_CONTEXT' or the 'TEST_NAME' column in another table. There is a 1:1 relationship between the 'FLOW_CONTEXT' and the 'TEST_NAME' columns in the table.
Here is the column formula I have, which always defaults to false, even though the SELECTEDVALUE part of the IF statement does work (checked via a card):
COLUMN_POINTER = IF(
SELECTEDVALUE(TEST_NAME_FIELD[TEST_NAME_FIELD]) = "FLOW_CONTEXT",
CCD_BINNING_TEST_RESULTS_LAST_RANK[FLOW_CONTEXT],
CCD_BINNING_TEST_RESULTS_LAST_RANK[TEST_NAME]
)
I have tried doing this with a measure but measures only see non-categorical columns. Thx much.
Columns are only calculated at refresh time - they do not respond to slicers filters in this way. You cannot re-calculate a column based on a selected value in a table visual.
You need to transform your use-case into a measure-friendly approach.
I'm beginning to think that what I'm looking for isn't actually possible.
I have two datasets - one of Titles and one of Keywords. Only one column from each is relevant to this query - Titles[Title] and Keywords[Keyword]. So pretty straightforward data. Titles has around 2 million rows, and Keywords will eventually have ~500-1000.
I would like to display a slicer of Keywords[Keyword] values, which will filter the Titles dataset where Titles[Title] contains one of the selected Keywords[Keyword] values.
I tried creating a DAX calculated column on Titles like below -
Matches = IF(SUMX(FILTER('Keywords','Keywords'[Keyword] <> ""),FIND(UPPER('Keywords'[Keyword]), UPPER(Titles[Title]),,0)) > 0,1, 0)
I then apply a report level filter for Matches >= 1. This works for all keyword values, but is not aware of the selection in the slicer.
I tried changing it to use ALLSELECTED('Keywords'[Keyword]) as the first argument passted to FILTER, but this doesn't seem to have any effect.
As a test, I created a Calculated Column and a Measure with the exact same DAX -
CONCATENATEX(VALUES(Keywords[Keyword]), Keywords[Keyword], ",")
This displays the slicer selection delimited by commas for the measure, but not for the column. Since I want to calculate this per row and filter the report based on this, a measure isn't suitable.
Is there any other way I can refer to the filtered Keywords[Keyword] in my calculated column? Or is there a way that a Measure could actually be used to achieve this? Or is there a completely different approach that I could try?
I am trying to add two currency columns in a calculated column but am getting a #NULL! error.
This seems pretty straightforward but its my first time doing this in SharePoint.
SharePoint 2010 with Excel Services available.
Have create List with required columns:
Approved Value column Type = Currency
Pending Value column Type = Currency
Total Value column
Calculated (calculation based on other columns)
Type = Currency
Formula: =[Approved Value]+[Pending Value]
The values in other columns are indeed currency, but the Total shows #NULL! for all items.
I can't see anything done incorrectly.
What should I be looking for to resolve this problem?
Try using the ISBLANK function to previously check if any of the value is null.
Reference: ISBLANK function
I ended up using NZ(Value, 0)
=NZ([Approved Value],0)+NZ([Pending Value],0)
Though not sure how NULLs ended up in field or why SharePoint couldn't deal with them without this special treatment.