Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17907

SELECTCOLUMNS - Issue when Using a Measure

$
0
0

I am using SELECTCOLUMNS create a new table called "My_Table" from an existing table called "Dedicated_Measures". I want to recover the "Week", "Product" and "Value" columns for a given week, i.e. 2018W34. I already have a measure in table "Dedicated_Measures" to recover the Value for this week which is called "Value 2018W34" which is defined as follows:

Value 2018W34 =
    CALCULATE(
        SUM(Dedicated_Measures[Value]),
        FILTER(ALL(Dedicated_Measures[Week]),Dedicated_Measures[Week] = "2018W34")
    )

I then created my new table using this measure:

 

My_Table =
    SELECTCOLUMNS(
        Dedicated_Measures,
        "Week", [Week],
        "Product", [Product],
        "Value 2018W34", Dedicated_Measures[Value 2018W34]
    )

 

My results gave me what I expected - values for Week = 2018W34, and no values for all other weeks. Filtering the results on 2018W34 and a single Product (for simplicity), I got the following results:

 

Untitled.png

 

 

 

However the sum across all the Products for 2018W34 didn't look correct. So I added another column to my new table which uses the original "Value" column in Dedicated_Measures. Once again filtering the results on 2018W34 and a single Product (for simplicity), I got the following results:

 

Untitled.png

 

I cannot figure out why, when using a measure, the results have doubled?! These two rows exist in my original data, and they both contain a value of 1506.93. Why when using a Measure do the values double? If I build the measure inside the DAX code which creates my new table, the results are correct.

Thanks in advance,

Ron


Viewing all articles
Browse latest Browse all 17907

Trending Articles



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