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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
salim123
Frequent Visitor

Calculate a measure that checks if data is blank and If so use previous montavg to do calcuations

Hello every one,

So I am new to dax and I am writing this measure that calculates a weighted value (SUMPROD(volume, TS) divided bySUM(Volume)), but the problem is that TS values are not there every day, so I have to multiply the volume with TS avg of the previuos month, I see that my reasoning is right bu something dosen't seem to work.
Here is My measure :

TS Ponderee (Madcap) =

        DIVIDE(
            SUMX('all years data',
            var c=0
            return
                 if('all years data'[T/S]<>BLANK(),'all years data'[Vol L]*'all years data'[T/S], 'all years data'[Vol L]*[previous_month_ts])
            ),
            SUMX(
                'all years data', 'all years data'[Vol L]
            )
        )

The previous month measure:

previous_month_ts = Calculate(
                        [T/S avg],
                        DATEADD(DateAnalyse[Date],-30,DAY)
                    )

Here is a piece of my data , as you can T/S is not there every time:

salim123_2-1662733660534.png

And here what I get when I show data as a table:

salim123_3-1662733991713.png

Any remark would be helpful.
thank you

 

 

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@salim123 Can you post your data and measure formulas as text?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank u Greg for ur feedback, I just did. thanks

Hi @salim123 ,

 

Has your problem been solved? If solved, please consider Accept it as the solution to help the other members find it more quickly.

 

Best regards,

Yadong Fang

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.