Forum Discussion

mberndt's avatar
mberndt
Regular Visitor
5 years ago

DAX help

Hi guys,

 

I would like to ask you to help me out with this problem.

 

I have 2 tables, one is a fact table and the other one is dimension table. In the dimension table the only column is Iterations (whole number). In the fact table: TABLE_COUNT (size of tables) and iteration also. There's a relationship between the two tables.

I would like to make a measure which calculates: TABLE_COUNT in each Iterations (so in Iteration (x)) divided by TABLE_COUNT in the first Iteration.

Tablecount (x Iteration) / Tablecount (Min iteration)

Then I would like to drag this measure into a visualization in which the x axis is Iteration. 

The measure I made:

Measure =
VAR iteration_min =
    MIN ( 'ITERATION'[ITERATION] )
VAR min_tablecount =
    CALCULATE (
        SUM ( 'facttable'[TABLE_COUNT] ),
        FILTER ( ALL ( ITERATION )iteracio_min )
    )
RETURN
    DIVIDE (
        CALCULATE ( SUM ( 'facttable'[TABLE_COUNT] ) ),
        CALCULATE (
            SUM ( 'facttable'[TABLE_COUNT] ),
            FILTER ( ALL ( 'ITERATION'[ITERATION] )iteration_min )
        ),
        0
    )

 

Thank you in advance for your replies!

4 Replies

  • mberndt's avatar
    mberndt
    Regular Visitor

    Also if might help... If I change the measure to this:

     
    Measure =
    VAR iteration_min =
        MIN ( 'ITERATION'[ITERATION] )
    RETURN
        DIVIDE (
            CALCULATE ( SUM ( 'NC_FALLOUT_TREND_DATA'[TABLE_COUNT] ) ),
            CALCULATE (
                SUM ( 'NC_FALLOUT_TREND_DATA'[TABLE_COUNT] ),
                FILTER ( 'ITERATION', 'ITERATION'[ITERATION] = iteration_min )
            ),
            0
        )
     
    I get 1,00 for the first row (minimum Iteration) and then 0,00 for all the others.