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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Measures with Date Tables

Hi,

 

I am very new to Power BI and I am having trouble using a measure with a date table.

 

I created a date table for looking up

Dates = CALENDAR(TODAY()-1000,TODAY()+1000)

 

within which I made a column called MonthYear

MonthYear = 'Dates'[MonthShortName]&" "&'Dates'[Year]

 

When I create charts from my 'Fact Sheet' (Table1) it works fine and groups the data in MonthYear as I want it to do.

 

However, when I make a chart that has this measure in it

(

SLA % = 1-
DIVIDE (
SUM ( Table1[Incident Breached] ),
SUM ( Table1[Count])
)
 
It calculates the SLA % correctly for the months within my 'Fact Sheet' (Table1) but also tries to calculate SLA % for every month in the 'Date table' where there are no corresponding months in my 'Fact Sheet' (Table1).
 
Screen Shot 04-09-19 at 02.59 PM.PNG
 
I hope this makes sense.
 
Any help would be much appreciated.
 
Thanks,
Martin
1 ACCEPTED SOLUTION

@Anonymous sorry missed a bracket

 

SLA % = 
VAR d = 
DIVIDE (
  SUM ( Table1[Incident Breached] ),
  SUM ( Table1[Count])
)
RETURN
IF (ISBLANK(d), BLANK(),1-d)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

10 REPLIES 10
mussaenda
Super User
Super User

@parry2k's answer is way better!

Anonymous
Not applicable

Thanks for your help @mussaenda  🙂

@Anonymous sorry missed a bracket

 

SLA % = 
VAR d = 
DIVIDE (
  SUM ( Table1[Incident Breached] ),
  SUM ( Table1[Count])
)
RETURN
IF (ISBLANK(d), BLANK(),1-d)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

It works perfectly @parry2k 

 

Thanks very much for the help.  Much appreciated! 🙂

parry2k
Super User
Super User

@Anonymous did you setup relationship between your date and transaction table?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Wow, that was quick 🙂  Thanks for getting back to me @parry2k 

 

Yes, I think(?) I have

Screen Shot 04-09-19 at 03.08 PM.PNG

Here you can see two charts, both are using the same MonthYear axis 

But the one in the left (which does not use a measure) seems to work fine.

Screen Shot 04-09-19 at 03.11 PM.PNG

try setting your relationship direction to both

@Anonymous problem is your measure is returning 1 when there is no value in divided by and that's why you are seeing all the dates. I wouldn't recomment to set the relationship to both direction since it can have performances issue on large dataset.

 

try following

 

SLA % = 
VAR d = DIVIDE (
SUM ( Table1[Incident Breached] ),
SUM ( Table1[Count])
RETURN
IF (ISBLANK(d), BLANK(),1-d)


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Hey @parry2k ,

 

I tried what you said but got the following error message:

 

The syntax for 'RETURN' is incorrect. (DAX(VAR d = DIVIDE (SUM ( Table1[Incident Breached] ),SUM ( Table1[Count])RETURNIF (ISBLANK(d), BLANK(),1-d))).

Anonymous
Not applicable

Thanks @mussaenda

 

I changed the direction to 'both' but it still doesn't work ??

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.