Quantcast
Channel: SQL Server Analysis Services forum
Viewing all 14337 articles
Browse latest View live

How to sum a measure value in MDX?

$
0
0

I have to create a measure which will be the sum of another measure. But in my output, I'm getting the count of the rows

Below are the MDX queries used

     Distinctdealer = Distinctcount(dealer])

   CREATE MEMBER CURRENTCUBE.[Measures].[Helper]
     AS IIF([Measures].[Netsales]<=0,NULL,[Measures].[Distinctdealer]);

   CREATE MEMBER CURRENTCUBE.[Measures].[Totalcount]
   AS SUM([Measures].[Helper]);

Attached images show the result of each measure. The expected output for the Totalcount(Measure) should be 2. But couldn't achieve it. Could anyone please help me with this?




Tabular Model Custom Sort

$
0
0

Hi everyone - 

I searched around for this and was unable to find a solid answer. I am looking to understand the most efficient way to sort a string column using a custom sort order in a SSAS tabular model (in import mode).

There are two ways that I know of to do this:

1. Create a sort table (essentially a dimension table) with 1 row for each value with a integer sort column and create a 1 to many relationship to my fact data.

2. Add a column to the fact table that contains an integer sort column that would assign a specific number to each unique value.

I am trying to understand which of these would be the most efficient in terms of performance (or if there are any better ways to do this.) I know that having too many relationships could possibly cause a performance impact and there are many sorts of this type that I need to perform. The columns that I need to sort typically have low cardinality. Does anyone have insight into what solution would be the most efficient in this situation?

Thank you.

Serious Performance Degradation when the Simplest Row Level Security condition is added to a role

$
0
0

We have a complex Tabular model through not a very large model. Strict Kimball construction where all measures are associated with a fact table and assembled star schemas. Using an optimized test query scraped from the Power BI Performance Analyzer to test performance, connecting with a role having no Row Level Security conditions defined, the query runs in ~100 ms on a 24GB machine with 4 cores. Total size of the Tabular model is ~ 10 GB.When any and I do mean any RLS condition is defined on that same role, performance of query degrades to ~8 seconds. I even added a two row table composed of a single integer column having no relationships to any other table in the model and adding a RLS condition to filter to just one row of that table caused the query to experience the same performance degradation. I would expect that an RLS condition defined for a table that had no relationships to any other table to have very little impact but I'm seeing the performance degrade to the point where our sponsor has suspended deployment.

Have tested on both SQL Server 2017 CU16 and SQL Server 2019 CTP and have seen the same behavior. Any ideas on where I should look?

Martin

Yes, this is a duplicate of this post. https://social.msdn.microsoft.com/Forums/en-US/75d81abe-41c8-411b-a35e-2a09884762e3/rls-in-ssas-2017-tabular-not-ready-for-prime-time?forum=sqlanalysisservices but if you can open that one than you're better off than I am.


Martin Mason Wordpress Blog

Need to create a 3mo Average as a Calculated Member (Measure) in SSAS Multidimensional

$
0
0

Hi, 

   I have researched many forums and still cannot make my 3mo average to work. Im using Visual Studio to create a new Calculated Member calle "3mo AVG". I have a Fiscal Time Hierarchy: Dimension Name = "Fiscal Time", Hierarchy Name = "FISCAL TIME HIERARCHY" and my Months level is called "FISCAL MONTH (Label Only)".  I need the Average to always be calculated at the month level.


My MDX looks like this:

AVG( { [FISCAL TIME].[FISCAL TIME HIERARCHY].[FISCAL MONTH (Label Only)].CURRENTMEMBER.LAG(2) :

[FISCAL TIME].[FISCAL TIME HIERARCHY].[FISCAL MONTH (Label Only)].CURRENTMEMBER } ,

[Measures].[AMOUNT or UNIT - WARRANTY] )

It is not working, I dont know what I'm I doing wrong. 


SSAS In Memory Consumed through Power BI

$
0
0

Hello ,

I have created an In-memory model built on SSAS Tabular .

When i am trying to consume the model using Power BI (live connection) , i am getting error using slicer .

I am dropping a dim column as slicer and trying to slice the fact, i get an unexpected exception error .

I am using 2017 SSDT . This is working as expected when i import to Power BI or power BI using direct query .I am not sure if i miss a update for SSDT, below is my config for now icrosoft SQL Server Management Studio14.0.17289.0

Microsoft Analysis Services Client Tools 14.0.1016.283
Microsoft Data Access Components (MDAC)10.0.14393.0
Microsoft MSXML3.0 6.0 
Microsoft Internet Explorer9.11.14393.0
Microsoft .NET Framework4.0.30319.42000
Operating System6.3.14393

The error message is 

"Cannot load image for the visual .

An unexpected error occurred "



How to create calculated measure that calculates median against more than one attribute ?

$
0
0

Hi ,

Please suggest an approach to calculate median against more than one attribute in SSAS.

Thanks in Advance

Neeraj Dubey

Tabular Model Error: The query referenced calculated column xx which does not hold any data because evaluation of one of the rows caused an error.

$
0
0

Hi,

Any help is highly appreciated!

I'm using SQL Server 2016 RC3 and SSDT in VS2015.
I built a SSAS Tabular Model by adding 1 table (Client table). Then I added a calculated column (LastDayOfMonth) to the table, with formula 

      =EOMONTH(Client[DateOfBirth], 0)

there's no issue to deploy to my SSAS database.

However, when I tried to run a DAX query on Client table,

evaluate

   (  

        'Client'  

   )

it threw an issue on the new column. The error message is:

The query referenced calculated column 'Client'[LastDayOfMonth] which does not hold any data because evaluation of one of the rows caused an error.


If I changed the new column to be a constant, something like "12", instead of a formula, it works fine.

Any idea why it throws error for a formula in the new column?

add new column to fact via table property keeps retrieving rows instead of just changing schema

$
0
0

Hi.

I am running into a situation where i am supposed new columns to a fact table in tabular model.I added the columns in partition query(source data) and when i edit the table property to include the new columns ,it retrieves rows soon after i select the needed columns and hit ok.The table contains ~77,45,618 rows.The operation throws an error stating not enough memory.Is there another way to add new columns to a table in the model without retrieving rows?


How to make Dimension attribute data type as Numeric in Excel.

$
0
0

Hi,

I need to your help to change the dimension attribute data type in Excel sheet when connecting cube via excel and I have defined a column as "FLOAT" in Data warehouse and "DOUBLE" in Cube,but that attribute is always displaying as string in Excel sheet when I connect the cube via Excel sheet.

and I didn't define the name column property as well because name column will always support string datatype.

Please find the below example from Adventure works cube to understand my scenario.

I have taken "Weight" attribute from Product dimension and the key column and Value column of this attribute has "Double" datatype  and Name column has "Wchar" datatype in the adventure works.

Because of Name column property , Weight attribute is showing as string in Excel sheet.

So I have removed the Name column definition to "Weight" attribute and I kept the Value column and Key column property as "Double" , but  still in excel "Weight" attribute is displaying as"String".

Can anyone please help to make this dimension attribute as "double" in excel sheet as well?

Thank you in advance for you help.

Bhavani R

Query total booking amount per month and the average user spending

$
0
0

Hi 

I am trying to query the total booking amount per month and the average user spending for the below table:

+-----------+---------+-------------------------+--------+-------------+
|   Time    | User Id |      Name Order Id      | Amount | First Order |+-----------+---------+-------------------------+--------+-------------+
| 1/1/2016  | 245723  | William Lam 10034455    | 5780   | Yes         |
| 1/1/2016  | 244567  | Ngo Yenphi 10036320     | 2312   | Yes         |
| 1/2/2016  | 267853  | Ho Tuan Anh 10036850    | 2434   | Yes         |
| 1/3/2016  | 245723  | William Lam 10036989    | 1100   | No          |
| 1/3/2016  | 295014  | Kathryb Penner 10037892 | 236    | Yes         |
| 1/3/2016  | 293356  | Afshe Shama 10040568    | 21578  | Yes         |
| 1/4/2016  | 293356  | Afshe Shama 10045552    | 150    | No          |
| ……        | ……      | …… ……                   | ……     | ……          |
| 9/25/2018 | 1101668 | Marge Fedler 56885800   | 23     | Yes         |
| 9/25/2018 | 244567  | Ngo Yenphi 56952241     | 5920   | No          |
| 9/26/2018 | 1201472 | Hung Le Manh 56992531   | 2300   | Yes         |
+-----------+---------+-------------------------+--------+-------------+

MDX Calculated Measure to Lookup Previous Period's Count?

$
0
0

Hi

I am trying to restate an existing question on this forum.

I have a cube design which allows me to pull a measure count which is grouped by a period and category dimension.

However, I do not have a measure group record for each period.

If a measure belonged to category "AAA" in the 2019/01 period I need to also reflect the same measure in period 2019/02 for category "AAA". Then in 2019/04 the measure may be re categorized to category "BBB" then from that period 2019/04 onwards I need to reflect the measure count under category "BBB" - again I will only have one measure record in 2019/04 when the record was re categorized from Category "AAA" to "BBB"....

my first MDX attempt:

CALCULATE; 
CREATE MEMBER CURRENTCUBE.[Measures].[CountV1]
 AS 
SUM
(
    (
        {[Period].CurrentMember.Level.Members}.Item(0):
        [Period].CurrentMember
    )
    * [Category].[Category Name].CurrentMember
,[Measures].[Count])
, 
VISIBLE = 1  ; 

The simple cube I am using to try and prototype a solution ...

Records in the measure group :

Records in the dimensions


I.W Coetzer

SQL Multiple Queries

$
0
0

Hi

I would like to query the below:

a. The list of customers who have purchased product A and any other products with unit prices over $100, and

b. Get the list of products purchased by the customers in question (a) with price over $100, the total quantity purchased per product and the total value per product

+---------+---------+-------+|  name   | product | price |+---------+---------+-------+| Kathy   | A       |1|| Kathy   | B       |150|| Kathy   | B       |150|| Chung   | C       |120|| Peter   | D       |40|| Peter   | E       |210|| Chris   | A       |1|| Chris   | W       |90|| William | A       |1|| William | K       |20|| William | K       |20|| William | N       |350|| Tina    | K       |500|| Tina    | P       |160|+---------+---------+-------+


Tabular server CU 16 crashes after submitting mdx query against a small direct query model

$
0
0

The following flow crashes tabular server with a direct query model

1. run mdx with calculated member [Measures].[Temp] as [Store sales] --Everything ok

2. run mdx with calculated member [Measures].[Temp] as STR([Store sales]) --Everything ok, however takes a few more seconds. not clear why

3. run mdx with calculated member [Measures].[Temp] as [Store sales] -- SERVER CRASHES (it crashes even if I close the connection in sql manager, reconnect and do step 3)

Tried some of the VBA functions... STR and FORMAT crash the server, CSTR does not

ParallelPeriod MDX

$
0
0

I have the following MDX query producing the results seen in image below.  How do I put the Count from the corresponding year prior month as another column?  For example, 201907 would have the corresponding value of 685286 (f/201807).  Note:  The YYYYMM column is an integer data type.  I tried using ParallelPeriod but it seems to just go back X number of rows, which produces the wrong result when corresponding period doesn't exist.

SELECT 
 NON EMPTY { 
  [Measures].[COUNT]
 } ON COLUMNS, 
 NON EMPTY {
  ([DATE].[YYYYMM].[YYYYMM].ALLMEMBERS )
 } ON ROWS
FROM 
 [MYCUBE];

SSAS Troublehooting


Delay processing dimensions daily more than 6 hrs

$
0
0

Hi,

I'm having an issue with the time processing on 3 dimensions, 2 has over 144600000 and the other 130000000 rows. Every day it's inserting between 7000 and 20000 rows on D-1. 

The time process it's more than 2 or 3 hours for each dimension and when all of them is finish, it runs process full of the cube to update the measures.

The D-1 process is a package in SSIS with the component "Dimension Processing", i created a query to get the data D-1 and insert to each dimension. 

My doubt is can the time process of the dimensions could be decrease?

The structure (type and size of the columns. EX: having more than 1 columns varchar(100)) of the dimension could be the reason of the delay?

Because inserting 1 or 20000 rows the time process still take more than 2 hours for one dimension with totally 144600000 rows ?

How to implement Column level security in Tabular Cube for SQL Server 2016 and belowi.e. model 1200 and below?

$
0
0

I want to implement column level security in a tabular cube.I am using SQL Server 2016. I understand that column level security works for Sql Server 2017 (i.e. model 1400) and above and row level security works very well in SSAS tabular cube. I want to implement column level security for a client requirement. 

Please find the below scenario for more details.

For Eg:

Say we have 2 tables. (1 Dimension, 1 Fact) with Columns

DimPerson  -->  (PersonId, Name, Designation, Salary, Location , Phonenumber)

DimSalary  --> (PersonId, Salary,LastSalaryWithdrawn)

I have 3 separate roles for the above model.

1. Full Access.

2. ExecutiveRole

3. StaffRole.

For 1(Full Access) I should be able to see entire data for all columns .

For 2(Executive Role) I should be able to see the data for Person Name, Designation and Salary. (thereby it should hide columns like, Phone number, Location from the client tools whether it is excel or power bi)

For 3(StaffRole) I should be able to see the  Person Name, Designation,LastDrawnSalary,PhoneNumber, Location(thereby it should hide columns like Salary)

Our objective is to hide the column names based on different roles we have. 

Tabular model not updated with latest info in source table

$
0
0

Dears,

I am struggling pretty hard on something that should (in my opinion) by really easy.

I have a rather easy database model with only 20 tables. Based on about 10 tables I need to create a tabular model.

So far so good no problem. Even on 15.000.000 records I get a result in les then 2 seconds.

The issue is with the refresh of the tables. When I want to refresh the largest table, I am obliged to go through a PROCESS FULL because with a PROCESS DEFAULT non of my changed data (neither updated nor inserted data) is retrieved in the model. Of course, the PROCESS FULL takes way too much time.

Can somebody please help me out why the PROCESS DEFAULT doesn't work and what I should do to update the model very fast. Even with partitions it's (in my opinion) too slow.

Thank you very very much for your help.

Dirk

How to find UserName from UPN ? RowLevelSecurity

$
0
0

Hi,

SSAS 2016 - 13.0.5264.1

from a powershell script I get members of an AD group.

I have the upn but do not find the username like Domain\username 

I can't remplace with a sql function because there are no simple rules

sample this the same upn end  ...@enterprise.com :

toto.tata@entreprise.com   => SG-R\toto.tata

marvel.iron@entreprise.com => VG\marvel.iron

thanks for your helps.


Stef

Cumulative value in OLAP cube

$
0
0

Hi everyone,

I have a OLAP cube which is connected to Power BI report. I need cumulative value, which is passed to Power BI. So, can I pass cumulative value to Power BI report using cube measures? Also, will it be filtered by filters inside of Power BI report. For example, I have values from 01.01.2018 till today, and if I put filter inside of report 01.06.2018, will it recalculate cumulative value?

THanks.

Regards,

Yerkhan

Viewing all 14337 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>