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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Dickkieee
Regular Visitor

How to modify my DAX to see weeks with no revenue.

I'm trying to visualize the total revenue per week, include the weeks with no revenue. For this purpose I tried to use 

 CALCULATE(
                    SUM('fct_test'[revenue]) ) 
 
Giving me the following result 
Dickkieee_0-1700591340834.png

But as you can see this visual is without the null weeks.

Therefore I tried it with the following DAX 

 

CALCULATE(
            SUM('fct_test'[revenue]),
            FILTER(
                ALL('DimDate'[Date]),
                'DimDate'[Date] <= MAX('DimDate'[Date])
 
The blue line is a target line (linear).
 
Dickkieee_1-1700591466548.png

 

How can I make a combination of both with the blue line and the first visualisation.

For the blue line I use the following dax

 

VAR b = [# CapaciteitHallen]
VAR a = 0.18
VAR pipestart = TODAY()
VAR maxdate = MAX(DimDate[Datum])
VAR x = datediff(pipestart,maxdate,week)
VAR line = b + a*b*x
RETURN IF(pipestart <= maxdate, line, BLANK())
 
Hope someone can help
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Dickkieee ,

To ensure that weeks with no revenue are included in your visual, you need to make sure that your date table (DimDate) has a continuous range of dates and that it is not filtered out by the relationships or the context of the report. Here's a revised version of your DAX measure that should help:

Total Revenue with Empty Weeks =
CALCULATE (
    SUM ( 'fct_test'[revenue] ),
    ALL ( 'DimDate' ),
    // This removes any filters from the DimDate table
    VALUES ( 'DimDate'[WeekNumber] ) // This ensures that you still group by week
)

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Dickkieee ,

To ensure that weeks with no revenue are included in your visual, you need to make sure that your date table (DimDate) has a continuous range of dates and that it is not filtered out by the relationships or the context of the report. Here's a revised version of your DAX measure that should help:

Total Revenue with Empty Weeks =
CALCULATE (
    SUM ( 'fct_test'[revenue] ),
    ALL ( 'DimDate' ),
    // This removes any filters from the DimDate table
    VALUES ( 'DimDate'[WeekNumber] ) // This ensures that you still group by week
)

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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