cancel
Showing results for 
Search instead for 
Did you mean: 

Calculation Group and Calculated Column problem

Hello,

I need help about the following behavior. I built a toy model to explicit the problem.

CalGroup is a calculation group with 2 calculation items:

to2: SELECTEDMEASURE()*2
to3: SELECTEDMEASURE()*3

Data is a simple table:

DATATABLE("Col", STRING, {{"A"},{"B"}})

to which I added the following measures:

BaseMeasure = IF(SELECTEDVALUE(Data[Col]) == "A", 1, 2)
To2Measure = CONVERT(CALCULATE([BaseMeasure], CalGroup[Name] == "to2"), INTEGER)
To3Measure = CONVERT(CALCULATE([BaseMeasure], CalGroup[Name] == "to3"), INTEGER)

 and I added the following calculated column to Data:

Col-BaseMeasure = CALCULATE([BaseMeasure])
Col-To2-Dir = CONVERT(CALCULATE([BaseMeasure], CalGroup[Name] == "to2"), INTEGER)
Col-To3-Dir = CONVERT(CALCULATE([BaseMeasure], CalGroup[Name] == "to3"), INTEGER)
Col-To2-Ind = CONVERT(CALCULATE([To2Measure]), INTEGER)
Col-To3-Ind = CONVERT(CALCULATE([To3Measure]), INTEGER)

When I run the following query:

 EVALUATE 'Data'

It yields:

ColCol-BaseMeasureCol-To2-DirCol-To3-DirCol-To2-IndCol-To3-Ind
A12311
B24622

 

The calculation group is not honored in indirect measure, but if I run:

 

 EVALUATE
    SUMMARIZE(Data, Data[Col]
        , "BaseMeasure", CALCULATE([BaseMeasure])
        , "Col-To2-Dir", CONVERT(CALCULATE([BaseMeasure], CalGroup[Name] == "to2"), INTEGER)
        , "Col-To3-Dir", CONVERT(CALCULATE([BaseMeasure], CalGroup[Name] == "to3"), INTEGER)
        , "Col-To2-Ind", CONVERT(CALCULATE([To2Measure]), INTEGER)
        , "Col-To3-Ind", CONVERT(CALCULATE([To3Measure]), INTEGER)
        )

I get the correct result.

 

What do I miss ?

 

Status: New
Comments
v-lili6-msft
Community Support

hi

I have tested on my side, it works well.

Calculate column and calculate table have the same result

1.JPG

 

could you share your sample pbix file for us have a test.

 

Regards,

Lin

Pavot
Frequent Visitor

Thanks Lin,

I realized the test under Sql Server 2019. This morning I test on Analysis service and it works. So I will try to update Sql Server.