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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

PRICE RANGE WITH DIFFERENT PARAMETER

Hi Guys,

 

I need help. We sell multiple item with different category. I need a DAX that will determine or create report base on different category with different  price range base. Example

 

 

CATEGORY    CATEGORY 2     PRICE  QTY SOLD
APPLE              FRUITS             300           4
BANANA          FRUITS            450            2
GRAPES           FRUITS             1000         7
DOG                ANIMALS         15000         8
CAT                 ANIMALS          700            2
GOAT              ANIMALS           5000         1
DRESS             CLOTHES           250           1
PANTS             CLOTHES           50            7
GOWN            CLOTHES         10000        10

 

 

SHEET 2

 


CATEGORY        ENTRY      MID                HIGH
FRUITS               0-300      301-999          above 1000
ANIMALS          0-5000      5001-10000    10001 above
CLOTHES           0-500         501-5000        5001 above

 

 

i want get total sold qty per category per price range. Hope you can help me.

 

thank you in advance

 

 

5 REPLIES 5
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Please apply below changes to Sheet2 in Query Editor mode.

 

Unpivot table.

1.PNG

 

Right click the [Value] column and select "Replace values". Then, split column.

3.PNG4.PNG5.PNG

 

In data view mode. Create calculated tables like below.

Sheet3 =
ADDCOLUMNS (
    FILTER (
        CROSSJOIN (
            SELECTCOLUMNS (
                Sheet1,
                "CATEGORY2", Sheet1[CATEGORY2],
                "PRICE", Sheet1[PRICE],
                "QTY SOLD", Sheet1[QTY SOLD]
            ),
            Sheet2
        ),
        [CATEGORY] = [CATEGORY2]
    ),
    "QTY", IF (
        [Max] <> BLANK ()
            && [PRICE] >= [Min]
            && [PRICE] <= [Max],
        [QTY SOLD],
        IF ( [Max] = BLANK () && [PRICE] >= [Min], [QTY SOLD], 0 )
    ),
    "Value Range", IF ( [Max] <> BLANK (), [Min] & "-" & [Max], "above " & [Min] )
)


Sheet4 =
SUMMARIZE (
    Sheet3,
    Sheet3[CATEGORY2],
    Sheet3[Range],
    Sheet3[Value Range],
    "Total QTY", SUM ( Sheet3[QTY] )
)

6.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yulgu-msft,

 

Good Afternoon,

 

Can you help about my problem?

 

Anyone who can help me?

 

 

Thank you,

 

Eanne

Anonymous
Not applicable

Hi GUys

 

Any help?

Anonymous
Not applicable

Hi @v-yulgu-msft,

 

Can you help me with regards to my new given data?

 

thank you,

 

Eanne

Anonymous
Not applicable

Hi Sir,

 

Thank you for immediate response. I forgot to incude that the 2 file have 1 connecting file. The masterfile (relationship)

 

FIRST FILE (MASTERFILE)

image.png

 

FILE 2 (with relationship in file 1 using item column)

 

 

image.png

 

 

FILE 3

 

already change the arrangement from previous file to lessen stepsalready change the arrangement from previous file to lessen steps

 

now need a DAX that will determine or create report base on different category with different  price range base.  using this 3 file

 

Category will be the basis of price range. 

i want get total sold qty per category per price range. Hope you can help me.

 

 

thank you so much in advance,

 

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.