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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sipati
Employee
Employee

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
Super User

@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])

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.

 

 

amitchandak
Super User
Super User

@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])

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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