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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Preeti_sharma
Regular Visitor

Client and Revenue Quintiles using Adventure Works 2019 dataset

Hi,

 

I'm really seeking urgent help on building the revenue and client quintiles using adventure works 2019 dataset.
I'm using these tables only - Sales.Customer, Sales.SalesOrderHeader, Sales.SalesOrderDetail, Production.Product,  Production.ProductSubcategory, Production.ProductCategory.
And measures only!           

I've gone as far as:

1. Creating a measure using - 

Customer Quintile =
VAR FirstQ =
    PERCENTILEX.INC (
        ALL (SalesOrderHeader ),
        SalesOrderHeader[CustomerID],
        .25
    )
VAR SecondQ =
    PERCENTILEX.INC (
        ALL ( SalesOrderHeader ),
        SalesOrderHeader[CustomerID],
        .50
    )
VAR ThirdQ =
    PERCENTILEX.INC (
        ALL ( SalesOrderHeader ),
        SalesOrderHeader[CustomerID],
        .75
    )
VAR ThisVal =
    MIN( SalesOrderHeader[CustomerID])
RETURN
    IF (HASONEVALUE(SalesOrderHeader[CustomerID]),
    IF(
        ThisVal <= FirstQ,
        1,
        IF (
            ThisVal > FirstQ
                && ThisVal <= SecondQ,
            2,
            IF ( ThisVal > SecondQ && ThisVal <= ThirdQ, 3, 4 )
        )
    ))
 
2. Creating an independent table named Client Quintile and having column Quintile with values: 1, 2, 3, 4, 5
and another measure in the standalone Cleint Quintile table as:
Client Quintile values =
SWITCH(
    SELECTEDVALUE('Client Quintile Table'[Client Quintile]),
    0,
        CALCULATE([Total Clients],
        'Client Quintile Table'[Client Quintile]=1),
    1,
        CALCULATE([Total Clients],
        'Client Quintile Table'[Client Quintile]=2),
    2,
        CALCULATE([Total Clients],
        'Client Quintile Table'[Client Quintile]=3),
    3,
        CALCULATE([Total Clients],
        'Client Quintile Table'[Client Quintile]=4),
    4,
        CALCULATE([Total Clients],
        'Client Quintile Table'[Client Quintile]=5),
    5
)

This is still not working when I'm trying to get these values in a chart visual without Customer ID.
I need help on how to create these quintiles properly and how to plot them in a line chart or show them in a table so that they can be used to slice my data correctly.
Thanks!
1 REPLY 1
lbendlin
Super User
Super User

Quintiles are .20, .40, .60 , .80  and 1 - Your code calculates quartiles.

Helpful resources

Announcements
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

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