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

SSAS tabular: how to get a value from a dimension for a distinct(ly) counted value from a fact?

$
0
0

Am new to DAX. I have the following query. I have 2 tables viz:

Invoice

InvoiceNumber   varchar(8)

InvoiceDate     date

ContainerNumber varchar(11)

Amount          decimal

InvoiceNumber    InvoiceDate     ContainerNumber     Amount

I1               2013-04-01      C1                  100

I2               2013-04-05      C2                  200

I3               2013-04-15      C1                  50

I4               2020-04-21      C2                  25

I5               2013-04-29      C1                  150

Container

ContainerNumber   varchar(11)

Weight            smallint

Table-Container

ContainerNumber   Weight(MT)

C1                2

C2                3

C3                4

  1. There could be multiple invoices for a ContainerNumber. Hence the container number would repeat and the Container table gives the weight for each container.
  2. One could assume that the container number will not have an invoice in another month.

I want a report that gives the following:

Month         No.of Cont.       Total Amount      Weight

Apr 2013         2 (*)                525                  5 MT (^) 

BUT it gives me the following which has wrong weight.

Apr 2013         2 (*)                525                  9 MT (^) 

(*) - list of distinct containers (^) - this should get counted only for the distinct list of containers, but it gives the total of the weight for all containers from the dimension.

(if you wish, I have an excel file using powerpivot where I have this example that I can send)

How can this be implemented? Any help would be appreciated.  Thanks in advance,

Rajeev Shah


Viewing all articles
Browse latest Browse all 14337

Trending Articles



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