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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Samurai_
Regular Visitor

Display Sales by Quarter

Hello,

 

I'm looking to try to display the total of sales within the last 4 quarters while keeping the same Carrier accross each quarter on the same line throughout the display. 
I tried using small multuiples however I couldnt get it to display correctly but still think small multuiples is the way to get it to work.
Here is a sample of data. The start is before or on the quarter start date and the end date is after that date. So if I was looking at this today 8/29/24, the following would show up in each section. 
Last Quarter: Policy 1 Policy 2 Policy 3 Policy 4 
2 Quarters Ago: Policy 1 Policy 2 Policy 4 
3 Quarters Ago: Policy 1 Policy 2 Policy 4 Policy 6
4 Quarters Ago: Policy 2 Policy 4 Policy 5 Policy 6

Samurai__0-1724960538957.png
Samurai__1-1724960646656.png
Above is what it looks like right now but what i'm trying to get it to look like is this (blocked names but kept a few letters to show that it is one carrier in the same position accross the whole row)

Samurai__0-1724964485326.png

 


I'm still new to power bi so any help would be appreciated. 

4 REPLIES 4
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from ahadkarimi , please allow me to provide another insight: 
Hi  @Samurai_ ,

 

Here are the steps you can follow:

1. Create calculated table.

Table 2 =
var _date=
CALENDAR(
    DATE(2022,1,1),DATE(2026,12,31))
return
ADDCOLUMNS(
    _date,"Qu",YEAR([Date])&" Q"&QUARTER([Date]))

vyangliumsft_0-1725009554259.png

2. Create calculated column.

Qu =
CONCATENATEX(
    FILTER(ALL('Table 2'),
    'Table 2'[Date]>='Table'[Start Date]&&'Table 2'[Date]<='Table'[End Date]),'Table 2'[Qu],"-")

vyangliumsft_1-1725009554263.png

3. Enter data – flag_Table.

vyangliumsft_2-1725009605697.png

4. Create measure.

Flag_last1 =
var _today=TODAY()
var _lastdate=EOMONTH(_today,-3)
var _qu=YEAR(_lastdate)&" Q"&QUARTER(_lastdate)
return
SUMX(
    FILTER('Table',
CONTAINSSTRING(
    MAX('Table'[Qu]),_qu)=TRUE()),[Value])
Flag_last2 =
var _today=TODAY()
var _lastdate=EOMONTH(_today,-6)
var _qu=YEAR(_lastdate)&" Q"&QUARTER(_lastdate)
return
SUMX(
    FILTER('Table',
CONTAINSSTRING(
    MAX('Table'[Qu]),_qu)=TRUE()),[Value])
Flag_last3 =
var _today=TODAY()
var _lastdate=EOMONTH(_today,-9)
var _qu=YEAR(_lastdate)&" Q"&QUARTER(_lastdate)
return
SUMX(
    FILTER('Table',
CONTAINSSTRING(
    MAX('Table'[Qu]),_qu)=TRUE()),[Value])
Flag_last4 =
var _today=TODAY()
var _lastdate=EOMONTH(_today,-12)
var _qu=YEAR(_lastdate)&" Q"&QUARTER(_lastdate)
return
SUMX(
    FILTER('Table',
CONTAINSSTRING(
    MAX('Table'[Qu]),_qu)=TRUE()),[Value])
Measure =
SWITCH(
    TRUE(),
    MAX('Flag_Table'[Flag])="Flag1",[Flag_last1],
    MAX('Flag_Table'[Flag])="Flag2",[Flag_last2],
    MAX('Flag_Table'[Flag])="Flag3",[Flag_last3],
    MAX('Flag_Table'[Flag])="Flag4",[Flag_last4])

5. Result:

vyangliumsft_3-1725009605708.png

 

 

Best Regards,

Liu Yang

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

@v-yangliu-msft This is great and just what I was looking for!

It looks like there is something wrong with the way its summing within the graphs. For example Flag1 should not be 12k for Carrier 4. Carrier 4 should display 4.7k. 

Samurai__0-1725553128335.png

 

ahadkarimi
Solution Specialist
Solution Specialist

Hi @Samurai_, try these measures below, and if you encounter any issues, let me know.

Last Quarter Sales = 
CALCULATE(
    SUM(Sales[Amount]),
    DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -1, QUARTER)
)

 

2 Quarters Ago Sales = 
CALCULATE(
    SUM(Sales[Amount]),
    DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -2, QUARTER)
)

 

3 Quarters Ago Sales = 
CALCULATE(
    SUM(Sales[Amount]),
    DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, QUARTER)
)

 

4 Quarters Ago Sales = 
CALCULATE(
    SUM(Sales[Amount]),
    DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -4, QUARTER)
)

 

Did I answer your question? If so, please mark my post as the solution! ✔️
Your Kudos are much appreciated! Proud to be a Solution Supplier!

I cant put measure data fields into "Small Multiples" section. Is there another way to display this?

Helpful resources

Announcements
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.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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