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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Include 'actual' values only if a 'forecast' value exists for the same date/category

My table is similar to the one below. It represents brick sales as of January 1950. Forecasted values are projected for Feb and March.

 

MonthYear              Category           Forecast/Actual         Value

Jan 1950                 Brick                   Forecast                   200

Feb 1950                 Brick                   Forecast                   300

Mar 1950                Brick                   Forecast                   420

Jan 1950                 Brick                   Actual                        250

Feb 1950                 Brick                   Actual                       0

Mar 1950                 Brick                  Actual                        0

 

I want to get the sum of forecasted values - but ONLY for the MonthYear values which have an 'Actual' value which is > 0. 

 

My knowledge of DAX is currently limited, and I've tried countless ways to do this without success (including a few table transformations, which didn't help and duplicated the 'actual' values for some reason! Is there any way to do this using the table above? 

 

Thanks. 

 

 

 

2 ACCEPTED SOLUTIONS
samdthompson
Memorable Member
Memorable Member

Hello, If I were you, I'd manipulate the table in power query for loading. Pivot the Forecast/Actual column over the Values. That way you can to a simple suming calculation rather than trying to DAX your way around a table tructure thats not quite right.

Cheers,

 

 

// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@samdthompson you're right, and that was my preferred approach. Unfortunately, the specific circumstances concerning my data didn't allow me to place the actual/forecast in the same rows, which led to peculiar results. I was therefore forced to use this approach. Thanks anyhow 🙂 

Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
samdthompson
Memorable Member
Memorable Member

Hello, If I were you, I'd manipulate the table in power query for loading. Pivot the Forecast/Actual column over the Values. That way you can to a simple suming calculation rather than trying to DAX your way around a table tructure thats not quite right.

Cheers,

 

 

// if this is a solution please mark as such. Kudos always appreciated.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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