Forum Discussion

Top006's avatar
Top006
Frequent Visitor
4 years ago
Solved

Dynamic grouping of data

Hi Community, I have a set of data similar to below: Region Store Order ID Request ID Order date Delivery date Date diff (Deliv. and order) EOS A 00820AK1 0082...
  • MFelix's avatar
    4 years ago

    Hi Top006 ,

     

    You can do the following:

    • Create a table with the Nomitation time:

    TypeID

    Early 1
    On time 2
    Late 3
    • Create a wath of parameter table
    • Change the slicer of the what if parameter table to a between
    • Add the following measure:
    Nomination time = 
    SWITCH (
        SELECTEDVALUE ( 'Nomination time'[Type] ),
        "Early",
            COUNTROWS (
                FILTER (
                    'Nominations',
                    'Nominations'[Date diff (Deliv. and order)] > MAX ( 'Low - High'[Low - High] )
                )
            ),
        "On Time",
            COUNTROWS (
                FILTER (
                    'Nominations',
                    'Nominations'[Date diff (Deliv. and order)] >= MIN ( 'Low - High'[Low - High] )
                        && 'Nominations'[Date diff (Deliv. and order)] <= MAX ( 'Low - High'[Low - High] )
                )
            ),
        "Late",
            COUNTROWS (
                FILTER (
                    'Nominations',
                    'Nominations'[Date diff (Deliv. and order)] < MIN ( 'Low - High'[Low - High] )
                )
            )
    ) + 0
    • Create a matrix with the following configuration:
      • Rows: [Nominations]Region
      • Columns: Nomination Time[Type]
      • Values: [Nomintaiton Time]

    Result below and in attach PBIX file.