Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Group several days

Hilfe.JPG

 

For my example I have some different cases I want to group by day.

 

I don't want to create groups manually, I want that the programm finds the field with the number e.g.: "0","1","2" and group them so that i can create a percentage to see how high the percent is if i group these days.

 

Please help me asap.

 

Best regards,

Tobias 

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

You can do 3options.

Option 1:

  • Create a table with the following setup:
    ID Range Min Max
    1 0-2 Days 0 2
    2 2-5 Days 3 5
    3 +5 Days 6 99999
  • Then create the following measure:

 

Percentage over total = 
CALCULATE (
    COUNT ( 'Cases'[Duration_to_solved [days]]] );
    FILTER (
        ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
        'Cases'[Duration_to_solved [days]]] <= SELECTEDVALUE ( Range[Max] )
            && 'Cases'[Duration_to_solved [days]]] >= SELECTEDVALUE ( Range[Min] )
    )
)
    / CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
    )

 

Option 2:

  • Create the following 3 measure:
  • 0 - 2 Days = CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        FILTER (
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
            'Cases'[Duration_to_solved [days]]] <= 2
                && 'Cases'[Duration_to_solved [days]]] >= 0
        )
    )
        / CALCULATE (
            COUNT ( 'Cases'[Duration_to_solved [days]]] );
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
        )
    
    
    
    2 - 5 Days = CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        FILTER (
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
            'Cases'[Duration_to_solved [days]]]  <= 5
                && 'Cases'[Duration_to_solved [days]]] >= 3
        )
    )
        / CALCULATE (
            COUNT ( 'Cases'[Duration_to_solved [days]]] );
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
        )
    
    + 5 Days = CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        FILTER (
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
                'Cases'[Duration_to_solved [days]]] >= 6
        )
    )
        / CALCULATE (
            COUNT ( 'Cases'[Duration_to_solved [days]]] );
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
        )

 

Option 3:

Create a group bin and a quick measure.

 

Check result in PBIX file attach (with the first two options).

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
MFelix
Super User
Super User

Hi @Anonymous ,

 

You can do 3options.

Option 1:

  • Create a table with the following setup:
    ID Range Min Max
    1 0-2 Days 0 2
    2 2-5 Days 3 5
    3 +5 Days 6 99999
  • Then create the following measure:

 

Percentage over total = 
CALCULATE (
    COUNT ( 'Cases'[Duration_to_solved [days]]] );
    FILTER (
        ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
        'Cases'[Duration_to_solved [days]]] <= SELECTEDVALUE ( Range[Max] )
            && 'Cases'[Duration_to_solved [days]]] >= SELECTEDVALUE ( Range[Min] )
    )
)
    / CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
    )

 

Option 2:

  • Create the following 3 measure:
  • 0 - 2 Days = CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        FILTER (
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
            'Cases'[Duration_to_solved [days]]] <= 2
                && 'Cases'[Duration_to_solved [days]]] >= 0
        )
    )
        / CALCULATE (
            COUNT ( 'Cases'[Duration_to_solved [days]]] );
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
        )
    
    
    
    2 - 5 Days = CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        FILTER (
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
            'Cases'[Duration_to_solved [days]]]  <= 5
                && 'Cases'[Duration_to_solved [days]]] >= 3
        )
    )
        / CALCULATE (
            COUNT ( 'Cases'[Duration_to_solved [days]]] );
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
        )
    
    + 5 Days = CALCULATE (
        COUNT ( 'Cases'[Duration_to_solved [days]]] );
        FILTER (
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] );
                'Cases'[Duration_to_solved [days]]] >= 6
        )
    )
        / CALCULATE (
            COUNT ( 'Cases'[Duration_to_solved [days]]] );
            ALLSELECTED ( 'Cases'[Duration_to_solved [days]]] )
        )

 

Option 3:

Create a group bin and a quick measure.

 

Check result in PBIX file attach (with the first two options).

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

@MFelix  THANKS, it worked!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.