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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
IamTDR
Responsive Resident
Responsive Resident

Any Suggests on Creating a Slicer Showing Loss of Business??

Hi
I am seeking suggestions/ideas on completing a requested task.
See image below.

Client would like to have a slicer that a end user could then select and see products that declined after initially having sold 10 or more products in a fiscal year.

So from my report, Product A in Fiscal Year 2017 Sold 68 units.  2018 Sold 211 so this would be labeled 'Business Still Exist'. Then in Fiscal Year 2019 the Units dropped below 10 so the label would be 'Loss of Business' but then in Year 2020 Units are back to Existing again.

Really not sure if this request is possible.  Each Product and year have multiple variables.
Any suggestions on how to proceed?

BI_Image.png

 

1 ACCEPTED SOLUTION
MohammadLoran25
Super User
Super User

Hi @IamTDR ,

Follow steps below:

Assume you have a DateTable.

 

1-Create a measure:

 

Product Quantity Sold = SUM(ProductSales[SalesQty])

 

 

2-Create a measure to calculate growth compared to previous year:

 

GrowthMasure = 
VAR _CurrentYear=MAX(DateTable[Year])

VAR _PreviousYear=_CurrentYear-1

VAR _CurrentYearSale=CALCULATE([Product Quantity Sold],FILTER(ALL(DateTable), DateTable[Year]= _CurrentYear))
VAR _PrevYearSale=CALCULATE([Product Quantity Sold],FILTER(ALL(DateTable), DateTable[Year]= _PreviousYear))

VAR _Growth=DIVIDE(_CurrentYearSale-_PrevYearSale,_PrevYearSale)

RETURN _Growth

 

 

3-Create a Table as below with the name 'StatusOfBusiness' :

StatusNameMinOfRangeMaxOfRange
Loss Of Business-21
Normal Business12
Business Still Exist23

You can change the records based on your need.

 

4-Create a Status Measure :

 

StatusMeasure =
CALCULATE (
    MIN ( StatusOfBusiness[StatusName] ),
    FILTER (
        StatusOfBusiness,
        [GrowthMasure] >= StatusOfBusiness[MinOfRange]
            && [GrowthMasure] < StatusOfBusiness[MaxOfRange]
    )
)

 

 

Then you can do it in diffrent ways:

1-Put this measure in your visual directly and then Put the status name field from the table we made as slicer.

2-Instead of putting this measure in your visual directly, you can put it in filterpane as a filter and set it to your desired value. For instance, "Loss of Business"

 

If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.

Regards,
Loran

View solution in original post

1 REPLY 1
MohammadLoran25
Super User
Super User

Hi @IamTDR ,

Follow steps below:

Assume you have a DateTable.

 

1-Create a measure:

 

Product Quantity Sold = SUM(ProductSales[SalesQty])

 

 

2-Create a measure to calculate growth compared to previous year:

 

GrowthMasure = 
VAR _CurrentYear=MAX(DateTable[Year])

VAR _PreviousYear=_CurrentYear-1

VAR _CurrentYearSale=CALCULATE([Product Quantity Sold],FILTER(ALL(DateTable), DateTable[Year]= _CurrentYear))
VAR _PrevYearSale=CALCULATE([Product Quantity Sold],FILTER(ALL(DateTable), DateTable[Year]= _PreviousYear))

VAR _Growth=DIVIDE(_CurrentYearSale-_PrevYearSale,_PrevYearSale)

RETURN _Growth

 

 

3-Create a Table as below with the name 'StatusOfBusiness' :

StatusNameMinOfRangeMaxOfRange
Loss Of Business-21
Normal Business12
Business Still Exist23

You can change the records based on your need.

 

4-Create a Status Measure :

 

StatusMeasure =
CALCULATE (
    MIN ( StatusOfBusiness[StatusName] ),
    FILTER (
        StatusOfBusiness,
        [GrowthMasure] >= StatusOfBusiness[MinOfRange]
            && [GrowthMasure] < StatusOfBusiness[MaxOfRange]
    )
)

 

 

Then you can do it in diffrent ways:

1-Put this measure in your visual directly and then Put the status name field from the table we made as slicer.

2-Instead of putting this measure in your visual directly, you can put it in filterpane as a filter and set it to your desired value. For instance, "Loss of Business"

 

If this answer solves your problem, give it a thumbs up and mark it as an accepted solution so the others would find what they need easier.

Regards,
Loran

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.