Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Measure in chart

Hi all,

 

I created a measure which works fine in table. But if I add it to a chart, it shows different values.

 

My Data

IDTypeFieldCustomerPicking DateBest before
1BananaAX01.01.201901.02.2019
2AppleAY01.02.201901.03.2019
3BananaBX01.03.201901.04.2019
4BananaAY01.05.201901.06.2019
5AppleBX01.03.201901.04.2019

 

Add this measure to always find the first picking date depending on the type.

Measure =
IF (
    SELECTEDVALUE ( TableName[Picking Date] )
        = CALCULATE (
            MIN ( TableName[Picking Date] ),
            VALUES ( TableName[Type] ),
            ALLSELECTED ( TableName )
        ),
    1,
    0
)

 

In the table it is correct but in the chart I get this

 

I think I have to SUM the Measure in the chart, but this is not possible. Any idea how to fix it?

 

Best regards

Timo

  • Anonymous's avatar
    Anonymous
    7 years ago
    PickFirst =
    IF (
        ISFILTERED ( Table1[Customer] ),
        CALCULATE (
            IF (
                SELECTEDVALUE ( Table1[Picking Date] )
                    = CALCULATE (
                        MIN ( Table1[Picking Date] ),
                        VALUES ( Table1[Type] ),
                        ALLSELECTED ( Table1 )
                    ),
                1,
                0
            ),
            FILTER (
                Table1,
                IF (
                    SELECTEDVALUE ( Table1[Picking Date] )
                        = CALCULATE (
                            MIN ( Table1[Picking Date] ),
                            VALUES ( Table1[Type] ),
                            ALLSELECTED ( Table1 )
                        ),
                    1,
                    0
                ) > 0
            )
        ),
        VALUES ( Table1[FirstPick] )
    )

    Use this code.

    First Pick is column created previous provided pbix.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Anonymous 

       

      thanks for your fast reply.

       

      But I need a measure. With a calculated column I can't filter on e.g. customer and the picking date will be calculatet. It is still the same. So I need this measure.

       

      Best regards

      • Anonymous's avatar
        Anonymous
        Not applicable

        Anonymous ,

         

        I am still not clear about your requirement.

        You can use the measure created by you and change X-axis type to Categorical.

        Solution

         

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.