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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Jackie003
Frequent Visitor

Different measure for different account number

Hello I have in my data model: Calendar table, FCT Parameters table, Forecast Costs table. In Forecast Costs table I have data from Jan 2024 till Oct 2024. I want to show data also for missing months. 

I made my dax formula to check if it's work and it' ok:

Forecast=
VAR maxdate =
    MAX ( 'Calendar'[Date])
RETURN
    CALCULATE (
        LASTNONBLANKVALUE ( 'Calendar'[Month], SUM ('Forecast Costs'[Quantity])*1.05 ),
        ALL ( 'Calendar' ),
        'Calendar'[Date] <= maxdate
    )
I can see future months with last available value for OCT (In Nov and Dec I can see OCT Values). I want to rebuild my formula for specific account numbers. In FCT Parameters table I have "Rule" column ("Average", "Prev Month" - thats my text values). I want to display future months (NOV and DEC), but when my account number has "Average" rule I want to see in NOV and DEC average costs from Jan to Oct. For "Prev Month" rule i want to see previous month value. Does Anyone can help with that? 
2 REPLIES 2
Jackie003
Frequent Visitor

Unfortunately, it does not work

bhanu_gautam
Super User
Super User

@Jackie003 , Try using below mentioned measure

 

Forecast =
VAR maxdate = MAX('Calendar'[Date])
VAR currentRule = SELECTEDVALUE('FCT Parameters'[Rule])
VAR result =
SWITCH(
currentRule,
"Average",
CALCULATE(
AVERAGEX(
DATESBETWEEN('Calendar'[Date], DATE(2024, 1, 1), DATE(2024, 10, 31)),
'Forecast Costs'[Quantity]
),
ALL('Calendar'),
'Calendar'[Date] <= maxdate
),
"Prev Month",
CALCULATE(
LASTNONBLANKVALUE('Calendar'[Month], SUM('Forecast Costs'[Quantity])),
ALL('Calendar'),
'Calendar'[Date] <= maxdate
),
// Default case if no rule matches
CALCULATE(
LASTNONBLANKVALUE('Calendar'[Month], SUM('Forecast Costs'[Quantity]) * 1.05),
ALL('Calendar'),
'Calendar'[Date] <= maxdate
)
)
RETURN
result




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.