cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sipati
Microsoft
Microsoft

Date shows as #,0.00 in PowerBi desktop of some machines

Hi, any idea why Date in a card visual showing in some machines PowerBi Desktop as- 

sipati_0-1603164183531.png


In other machines (with same version of PowerBi Desktop) and also on PowerBi Workspace, it is showing as properly as date-

sipati_1-1603164240530.png

 

It is a measure-

DateMeasure = SELECTEDVALUE(SampleView[DateColumn]," ")


SampleView[DateColumn] is formatted as -

 
 

Capture.JPG
It is a coming from a view (Directquery SQL) as - 

CAST(ISNULL(DateColumn,'') AS VARCHAR(25))     AS DateColumn
2 ACCEPTED SOLUTIONS
amitchandak
Super User IV
Super User IV

@sipati , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Can you try only

DateMeasure = SELECTEDVALUE(SampleView[DateColumn])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

v-alq-msft
Community Support
Community Support

Hi, @sipati 

 

Based on your description, I created data to reproduce your scenario. The data source is Sql Server(DirectQuery).

SampleTable:

b1.png

 

Then you may create a measure as below.

Measure = SELECTEDVALUE(SampleTable[DateColumn],TODAY())

 

Result:

b2.png

 

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

4 REPLIES 4
v-alq-msft
Community Support
Community Support

Hi, @sipati 

 

Based on your description, I created data to reproduce your scenario. The data source is Sql Server(DirectQuery).

SampleTable:

b1.png

 

Then you may create a measure as below.

Measure = SELECTEDVALUE(SampleTable[DateColumn],TODAY())

 

Result:

b2.png

 

b3.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

amitchandak
Super User IV
Super User IV

@sipati , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Can you try only

DateMeasure = SELECTEDVALUE(SampleView[DateColumn])



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

View solution in original post

Yeah.

Query-

CREATE TABLE dbo.SampleTable (
[Id] INT NOT NULL,
[DateColumn] DATETIME NOT NULL
);

 

INSERT INTO dbo.SampleTable (Id, DateColumn) VALUES (1,'7/1/2020 00:00:00 AM');
INSERT INTO dbo.SampleTable (Id, DateColumn) VALUES (2,'7/2/2020 00:00:00 AM');
INSERT INTO dbo.SampleTable (Id, DateColumn) VALUES (3,'7/3/2020 00:00:00 AM');

 

CREATE VIEW dbo.SampleView
AS
SELECT DISTINCT ISNULL(Id,'') AS Id,
CAST(ISNULL(DateColumn,'') AS VARCHAR(25)) AS DateColumn
FROM dbo.SampleTable

UNION

SELECT '' AS Id,
'' AS DateColumn
FROM (SELECT 1 AS ID)A
WHERE NOT EXISTS
(
SELECT DISTINCT ISNULL(Id,'') AS Id,
CAST(ISNULL(DateColumn,'') AS VARCHAR(25)) AS DateColumn
FROM dbo.SampleTable
)

 

PBIX (source: localhost; "test" database DirectQuery SQL):

Sample PBIX Link 

Yes, will try selectedvalue(SampleView[DateColumn]) instead of selectedvalue(SampleView[DateColumn], " ")

@sipati , any reason for casting datetime as varchar while bringing to power bi. Unless it is super needed do yo cast as varchar



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors