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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
admin11
Memorable Member
Memorable Member

YTD expression return null value

Hi All

 

I Have below expression work fine , it return correct amount :-

 

SUM_YTD = SUMX('_PNL_Table','_PNL_Table'[Switch_YTD]).

 

admin11_0-1613016936390.png

 

 

But below expression display Null :-

 

Switch_YTD = SWITCH(SELECTEDVALUE('_PNL_Table'[REV&COGS]),

"COGS",[_YTD COGS],

"REV", [_YTD REV],

"OTH", [_YTD OTH],

"EXP", [_YTD EXP]

)

 

admin11_0-1613017038601.png

 

Can some one share with me where go wrong ?

 

Paul

5 REPLIES 5
admin11
Memorable Member
Memorable Member

hi @admin11 - The measure will calculate based on a particular value of GL type (COGS, EXP, OTH, REV) - hence you will have to add a slicer into your report for the same. Please see screenshot below for reference. 

 

Sumanth_23_0-1613019100221.png

 

Attached is the updated pbix file. 

 

 

Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue.

Thanks!

Sumanth

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!

Proud to be a Super User!



@Sumanth_23 


When i click Step 2 , it select year = 2020 , Table 2 YTD expression display value is correct.

 

When i click Step 1 , it select year = 2019 , Table 2 YTD expression display null. But Table 1 display there are value.

 

Below is my PBI file :-

https://www.dropbox.com/s/22lziixb1kx8nf2/APPEND%202%20GL%20INTO%201%20V006.pbix?dl=0

admin11_1-1613020746134.png

 


Paul Yeo

 

@admin11 , This seems like issue the way X function behaves

I tried

Measure = SELECTEDVALUE('_PNL_Table'[REV&COGS]) value is null when nothing is selected

then I tried

Measure = SUMX('_PNL_Table',[Measure] ), I am getting values

 

Then I tried

SUM_YTD = SUMX('_PNL_Table',SWITCH(SELECTEDVALUE('_PNL_Table'[REV&COGS]),
"COGS",[_YTD COGS],
"REV", [_YTD REV],
"OTH", [_YTD OTH],
"EXP", [_YTD EXP]
))

 

This gives null like Switch_YTD

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Kindly share PBI file , so i can figure out how you changes and make it work.

Thank

Paul

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.