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
bhelou
Responsive Resident
Responsive Resident

wrong dates in line chart

Dear , I have this measure for the Balances the measure giving correct resutls in table but when making as a line chart and puting the dates , the value is correct but the dates are showing till the end of the dates table that i have .
* I have dates table its all correct 
* i have made future month filter measure so i can select the true dates the falls in the normal calendar no need for future dates 
this is the dates filter that im using in the report directrly 

bhelou_0-1661155305961.png

this dates measure is correct in all reports .


Kindly help me in the Measure below ( knowing that its giving correct results in tables and matrix but when making a chart line its giving dates to the end date table i have ) , i think its from the ALL ( '*Dates' ) filter below in the mesaure  , i remved All filter but gave me wrong result when removing all filter from the date . Kindly help if possible  

AP_TRIAL_BALANCE_OPENNING_BALANCE =
VAR Openning_Debit =
CALCULATE (
[AP_TRIAL_BALANCE_DEBIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date]
< MIN ( '*Dates'[Date] )
)
) * -1

VAR
Openning_Credit =
CALCULATE (
[AP_TRIAL_BALANCE_CREDIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date]
< MIN ( '*Dates'[Date] )
)
) * -1

VAR
Openning_Balance = Openning_Debit - Openning_Credit

RETURN

CALCULATE
(
IF (
ISBLANK ( Openning_Balance ),
0,
Openning_Balance
))

 

bhelou_0-1661155668335.png

 

3 ACCEPTED SOLUTIONS
PVO3
Impactful Individual
Impactful Individual

It's hard to guess. Buyt you could try something like this.

 

AP_TRIAL_BALANCE_OPENNING_BALANCE =
VAR Openning_Debit =

CALCULATE (
[AP_TRIAL_BALANCE_DEBIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date] < MIN ( '*Dates'[Date] )
)
)

VAR Openning_Credit =

CALCULATE (
[AP_TRIAL_BALANCE_CREDIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date] < MIN ( '*Dates'[Date] )
)
)

VAR Openning_Balance = Openning_Debit - Openning_Credit

RETURN

CALCULATE(
IF (
ISBLANK ( Openning_Balance ) && MAX(fact table[date]) <= MAX('*Dates'[Date]),
0,
FORMAT(Openning_Balance, -0.000)
)
)

View solution in original post

bhelou
Responsive Resident
Responsive Resident

Thank you  very much it worked 
CALCULATE(
IF (
ISBLANK ( Openning_Balance ) && MAX(fact table[date]) <= MAX('*Dates'[Date]),
0,
FORMAT(Openning_Balance, -0.000)
)
)

View solution in original post

bhelou
Responsive Resident
Responsive Resident

This is the working Variab;e , Thanks , 

CALCULATE (
IF (
ISBLANK ( Openning_Balance ) && NOT ( ISBLANK ( COUNTROWS ( '*Dates' ) ) ),
0,
Openning_Balance
)
)

View solution in original post

6 REPLIES 6
PVO3
Impactful Individual
Impactful Individual

It's hard to guess. Buyt you could try something like this.

 

AP_TRIAL_BALANCE_OPENNING_BALANCE =
VAR Openning_Debit =

CALCULATE (
[AP_TRIAL_BALANCE_DEBIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date] < MIN ( '*Dates'[Date] )
)
)

VAR Openning_Credit =

CALCULATE (
[AP_TRIAL_BALANCE_CREDIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date] < MIN ( '*Dates'[Date] )
)
)

VAR Openning_Balance = Openning_Debit - Openning_Credit

RETURN

CALCULATE(
IF (
ISBLANK ( Openning_Balance ) && MAX(fact table[date]) <= MAX('*Dates'[Date]),
0,
FORMAT(Openning_Balance, -0.000)
)
)

bhelou
Responsive Resident
Responsive Resident

This is the working Variab;e , Thanks , 

CALCULATE (
IF (
ISBLANK ( Openning_Balance ) && NOT ( ISBLANK ( COUNTROWS ( '*Dates' ) ) ),
0,
Openning_Balance
)
)
bhelou
Responsive Resident
Responsive Resident

Thank you  very much it worked 
CALCULATE(
IF (
ISBLANK ( Openning_Balance ) && MAX(fact table[date]) <= MAX('*Dates'[Date]),
0,
FORMAT(Openning_Balance, -0.000)
)
)

PVO3
Impactful Individual
Impactful Individual

Hi,

 

You should remove the * -1 at the end of your variables.

Perhapse change this to something like below (depending on regional preferences).

FORMAT ([measure] , -0.000) 

 

bhelou
Responsive Resident
Responsive Resident

Dear , 

i Made it like this but gave me error couldnt display any visiual 

AP_TRIAL_BALANCE_OPENNING_BALANCE =
VAR Openning_Debit =
FORMAT(
CALCULATE (
[AP_TRIAL_BALANCE_DEBIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date]
< MIN ( '*Dates'[Date] )
)

),-0.000)
VAR Openning_Credit =
FORMAT(
CALCULATE (
[AP_TRIAL_BALANCE_CREDIT],
FILTER (
ALL ( '*Dates' ),
'*Dates'[Date]
< MIN ( '*Dates'[Date] )
)
),-0.000)
 
VAR Openning_Balance = Openning_Debit - Openning_Credit
RETURN
CALCULATE(
IF (
ISBLANK ( Openning_Balance ),
0,
Openning_Balance
))

formating it didnt work 

bhelou
Responsive Resident
Responsive Resident

Dear , 

I have removed the if condition ( is blank  ) but in the visual card is giving me blank now i need it 0 ...

CALCULATE(
IF (
ISBLANK ( Openning_Balance ),
0,
Openning_Balance
))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors