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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ys034
Helper I
Helper I

How to handle infinty values based on Date

Hello Power BI Community

 

I have a question regarding Infinity values
In my matrix I want the market share in the column for 2021 to show me the percentages for last year.

 

ys034_0-1642074416336.png

 

My Measures: 

Grand Total Sales LY = CALCULATE(SUMX(VALUES('DataTable'),'DataTable'[Total Sales LY]),filter(ALLSELECTED('DataTable'), 'DataTable'[Date].[Year] = MAX('DataTable'[Date].[Year])),FILTER(ALLSELECTED('DataTable'),'DataTable'[Country] = MAX('DataTable'[Country])))
 
MarketShareFilter LY = CALCULATE([Grand Total Sales LY],All('DataTable'[Brand]))
 
MarketShare LY = CALCULATE([Total Sales LY]/[Grand Total Sales LY])

 

4 REPLIES 4
ValtteriN
Super User
Super User

Hi,

The infinity is caused here by division. As a best practice you should use DIVIDE instead of "/". For LY calculation you can link your fact table to a calendar and create DAX like this:

LY measure = CALCULATE([Your Measure],SAMEPERIODLASTYEAR('Calendar'[Date]))

I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!






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

Proud to be a Super User!




amitchandak
Super User
Super User

@ys034 , Try like

 

change this first

Grand Total Sales LY = CALCULATE([Total Sales LY],allselected())

 

then

divide([Total Sales LY],[Grand Total Sales LY],0)

 

Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

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

unfortunately it did not work I have tried it with two measures at a time

in the first picture with the measure

 

ys034_2-1642084547501.png

  MyMeasure: Grand Total Sales LY = CALCULATE([Total Sales LY],allselected())


and in the second measure I applied another AllSelected filter in the measure

 

ys034_1-1642084443129.png

 

MyMeasure= Grand Total Sales LY = CALCULATE([Total Sales LY],ALLSELECTED(),FILTER(ALLSELECTED('DataTable'),'DataTable'[Country] = MAx('DataTable'[Country])))

 

 

i hope anybody can help me out i would be grateful

Icey
Community Support
Community Support

Hi @ys034 ,

 

How about this:

Grand Total Sales LY =
CALCULATE ( [Total Sales LY], ALLEXCEPT ( 'DataTable', 'DataTable'[Country] ) )

 

If the above doesn't work, please share us some sample data for test. For your data security, please don't contain any sensitive information.

 

Reference: 

How to Get Your Question Answered Quickly - Microsoft Power BI Community

How to provide sample data in the Power BI Forum - Microsoft Power BI Community

 

 

Best Regards,

Icey

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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