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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
tyan
Helper II
Helper II

How to set up multi condition and then calculate the value

tyan_0-1639495210015.png

 

Hi. Thank you for helping me! I am a beginner still learning how to do powerbi...

so i have a database somthing like the table above.   I would like to calculate quanity % and price % by brand and department level.  The thing is I have to spill them by three conditions, >=100%,  between 99% ~ 70%, and less than 70%

 

The result I would like to show is provided in below table... I use NIKE as my example...  ( quanity %)

In my powerbi modeing, I have created a now column indicated which one is >=100%,  between 99% ~ 70%, and less than 70% this three condition.  But im still lost.. just dont show the below number that im looking for..

 

 

Someone please help~ 

tyan_1-1639495274860.png

 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @tyan ,

 

Please check if this is what you want:

Icey_0-1640151945354.png

 

Steps:

1. Enter data to create a Group table.

Icey_0-1640153136958.png

 

 

2. Create measures.

Quantity Measure 1 = 
SWITCH (
    MAX ( 'Group'[Order] ),
    1,
        CALCULATE (
            SUM ( 'Table'[Quantity] ),
            FILTER ( 'Table', 'Table'[Forecast vs Color] >= 1 )
        ),
    2,
        CALCULATE (
            SUM ( 'Table'[Quantity] ),
            FILTER (
                'Table',
                'Table'[Forecast vs Color] >= 0.7
                    && 'Table'[Forecast vs Color] <= 0.9
            )
        ),
    3,
        CALCULATE (
            SUM ( 'Table'[Quantity] ),
            FILTER ( 'Table', 'Table'[Forecast vs Color] < 0.7 )
        )
)
Quantity Measure 2 = 
SUMX ( VALUES ( 'Group'[Group] ), [Quantity Measure 1] )

 

3. Create Matrix visuals.

Icey_1-1640153205785.png

Icey_2-1640153244243.png

 

 

 

Best Regards,

Icey

 

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

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @tyan ,

 

Please check if this is what you want:

Icey_0-1640151945354.png

 

Steps:

1. Enter data to create a Group table.

Icey_0-1640153136958.png

 

 

2. Create measures.

Quantity Measure 1 = 
SWITCH (
    MAX ( 'Group'[Order] ),
    1,
        CALCULATE (
            SUM ( 'Table'[Quantity] ),
            FILTER ( 'Table', 'Table'[Forecast vs Color] >= 1 )
        ),
    2,
        CALCULATE (
            SUM ( 'Table'[Quantity] ),
            FILTER (
                'Table',
                'Table'[Forecast vs Color] >= 0.7
                    && 'Table'[Forecast vs Color] <= 0.9
            )
        ),
    3,
        CALCULATE (
            SUM ( 'Table'[Quantity] ),
            FILTER ( 'Table', 'Table'[Forecast vs Color] < 0.7 )
        )
)
Quantity Measure 2 = 
SUMX ( VALUES ( 'Group'[Group] ), [Quantity Measure 1] )

 

3. Create Matrix visuals.

Icey_1-1640153205785.png

Icey_2-1640153244243.png

 

 

 

Best Regards,

Icey

 

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

amitchandak
Super User
Super User

@tyan , if you have already created a column with these values then you can use that in the matrix column to pivot the data. You can use count in values ?

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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