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
RT6
Frequent Visitor

Dynamic calcualtion for the next 6, 12 months

hi all,

 

i need to create such calcualtion, based on the data below:

 

IDClose QClose MEst.Start DateEst.End DateEstimated Close DateSegmentTotal Sales Value (USD)2023-Sep (USD)2023-Oct (USD)2023-Nov (USD)FY2024-Q1 (USD)2023-Dec (USD)2024-Jan (USD)2024-Feb (USD)FY2024-Q2 (USD)2024-Mar (USD)2024-Apr (USD)2024-May (USD)FY2024-Q3 (USD)2024-Jun (USD)2024-Jul (USD)2024-Aug (USD)FY2024-Q4 (USD)FY2024-Total (USD)2024-Sep (USD)2024-Oct (USD)2024-Nov (USD)FY2025-Q1 (USD)2024-Dec (USD)2025-Jan (USD)2025-Feb (USD)FY2025-Q2 (USD)2025-Mar (USD)2025-Apr (USD)2025-May (USD)FY2025-Q3 (USD)2025-Jun (USD)2025-Jul (USD)2025-Aug (USD)FY2025-Q4 (USD)FY2025-Total (USD)Future Revenue (USD)W 2023-Sep (USD)W 2023-Oct (USD)W 2023-Nov (USD)W FY2024-Q1 (USD)W 2023-Dec (USD)W 2024-Jan (USD)W 2024-Feb (USD)W FY2024-Q2 (USD)W 2024-Mar (USD)W 2024-Apr (USD)W 2024-May (USD)W FY2024-Q3 (USD)W 2024-Jun (USD)W 2024-Jul (USD)W 2024-Aug (USD)W FY2024-Q4 (USD)W FY2024-Total (USD)W 2024-Sep (USD)W 2024-Oct (USD)W 2024-Nov (USD)W FY2025-Q1 (USD)W 2024-Dec (USD)W 2025-Jan (USD)W 2025-Feb (USD)W FY2025-Q2 (USD)W 2025- Mar(USD)W 2025-Apr (USD)W2025-May (USD)W FY2025-Q3 (USD)W 2025-Jun (USD)W 2025-Jul (USD)W 2025-Aug (USD)W FY2025-Q4 (USD)W FY2025-Total (USD)W Future Revenue (USD)
A000374210Q4June01/03/202431/05/202402/06/2024S1131979,050000000041993,3443993,0245992,7131979,060000131979,06000000000000000000000000004199,334399,34599,2713197,91000013197,91000000000000000000
A000374325Q3May27/05/202426/07/202417/05/2024S221253,9100000000002361,552361,559446,189446,18018892,3621253,9100000000000000000000000000001416,931416,935667,715667,71011335,4212752,35000000000000000000
A000375012Q4June25/06/202416/12/202416/06/2024S3541758,7700000000000017336,2899683,6195349,54212369,43212369,4391015,4799683,6191015,47281714,5547674,770047674,7700000000329389,3200000000000003467,2619936,7219069,9142473,8942473,8918203,0919936,7218203,0956342,919534,95009534,950000000065877,860
A000375098Q4July26/07/202426/10/202426/07/2024S310000000000000000006060,6133333,3339393,9439393,9431818,1828787,88060606,0600000000000060606,0600000000000000606,063333,333939,393939,393181,822878,7906060,610000000000006060,610
A000375131Q1November07/11/202408/01/202507/11/2024S452791,62000000000000000000019943,519943,525809,237038,89032848,120000000052791,62000000000000000000007977,47977,410323,692815,56013139,250000000021116,650
A000375267Q1September20/09/202423/01/202520/09/2024S2527916,210000000000000000041060,15134911,92123180,45299152,52129046,1899717,50228763,6800000000527916,20000000000000000004106,0213491,1912318,0529915,2512904,629971,75022876,370000000052791,620

 

Eventual output should be the following matrix:

 

 S1S2S3S4S5S6
L      
M      
S      
XS      

 

L> 2M Revenue next rolling 12 months
M500k-2M Revenue next rolling 12 months
S<500k Revenue next rolling 12 months
XS<500k Revenue next rolling 6 months

 

I have prepared such calcuation, but the column names with Q1-Q4 are hard coded. Is it possible to do it dynamic with DAX or within Power Query?

Next 6 Months Revenue =
VAR CurrentDate = TODAY()
VAR EndPeriodDate = EDATE(CurrentDate, 6)
RETURN
CALCULATE (
    SUMX (
        _Fact_RPT,
        _Fact_RPT[FY2024-Q2 (USD)] +  // Assuming the current date falls in FY2024-Q1
        _Fact_RPT[FY2024-Q3 (USD)] +
        _Fact_RPT[FY2024-Q4 (USD)] +
        _Fact_RPT[FY2025-Q1 (USD)]
    ),
    _Fact_RPT[Est.Start Date] <= EndPeriodDate,
    _Fact_RPT[Est.End Date] >= CurrentDate
)

 

Any help appreciated!

1 ACCEPTED SOLUTION
v-tianyich-msft
Community Support
Community Support

Hi @RT6 ,

 

It looks like you need L,M,S,XS data, but I'm only looking at M data. In any case, you may need to use to unpivot column.

 

Best regards,
Community Support Team_ Scott Chang

View solution in original post

4 REPLIES 4
RT6
Frequent Visitor

Hi v-tianyich-msft,

 

thanks your response. I have unpivotted and selcted only the months i need. I was able to calculate as well 

Rolling 6M Next =
CALCULATE(
    SUM('_Fact_'[Value]),  
    DATESINPERIOD(
        'DateTable'[Date],
        TODAY(),
        6,
        MONTH
    )
)
 
and 
Rolling 12M Revenue =
CALCULATE(
    SUM('_Fact_'[Value]),  
    DATESINPERIOD(
        'DateTable'[Date],
        TODAY(),
        12,
        MONTH
    )
)
 
The issue is how to categorize this data based on my conditions, when i tr something like that: Company Size Category =
VAR Rolling12M = [Rolling 12M Revenue]
VAR Rolling6M = [Rolling 6M Next]
RETURN
SWITCH(
TRUE(),
Rolling12M > 2000000, "L",
Rolling12M >= 500000 && Rolling12M <= 2000000, "M",
Rolling6M < 500000, "S",
Rolling12M < 500000, "XS",
"Uncategorized"
)
 
I see only M and S, however if i add dates to rows, i can see there are should L categories.
RT6_2-1714314577010.png

An ideas? Thanks in advance!"

 


 




Hi @RT6 ,

 

Try changing the order in switch, using the following expression:

Company Size Category =
VAR Rolling12M = [Rolling 12M Revenue]
VAR Rolling6M = [Rolling 6M Next]
RETURN
SWITCH(
TRUE(),
Rolling12M >= 500000 && Rolling12M <= 2000000, "M",
Rolling12M > 2000000, "L",
Rolling6M < 500000, "S",
Rolling12M < 500000, "XS",
"Uncategorized"
)

 

Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

Hi V-tianyich.msft,

 

thanks for your fast response. Changing order gives the same results. I assume it calcualted not the sum of the Rolling Revenue, but takes the value only for 1 month, in this case each of them is less than 500,000, therefore there are no L or S and it shows it as XS. The solution was to include ALLEXCEPT filter into calcualtion Company Size Category_Total =
VAR Rolling12M = CALCULATE(
[Rolling 12M Revenue],
ALLEXCEPT('_Fact_', '_Fact_'[Opportunity ID]) // Removing all filters except for Opportunity ID
)
VAR Rolling6M = CALCULATE(
[Rolling 6M Next],
ALLEXCEPT('_Fact_', '_Fact_'[Opportunity ID]) // Similarly, for the 6-month calculation
)
RETURN
SWITCH(
TRUE(),
Rolling12M >= 500000 && Rolling12M <= 2000000, "M",
Rolling12M > 2000000, "L",
Rolling6M < 500000, "XS",
Rolling12M < 500000, "S",
"Uncategorized"
)

 

 

v-tianyich-msft
Community Support
Community Support

Hi @RT6 ,

 

It looks like you need L,M,S,XS data, but I'm only looking at M data. In any case, you may need to use to unpivot column.

 

Best regards,
Community Support Team_ Scott Chang

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.