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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

DAX Measures for Date while using Power BI Dataset

Hi, I am fairly new to Power BI.

 

I am using a dataset (Power BI dataset) as the source for my new report.  I am trying to create a new measure using data calculations.  Essentially, I have a column [Partner Deal Created Date] with date values: yyyy-mm-dd

I would like to add a measure column next to it with the previous month value (integer).  Example ideal output:

 

Partner Deal Created DatepreviousMonth
2021-07-306
2021-06-305
2021-05-304

 

However whenever I try to perform a PREVIOUSMONTH (or just about any Date calculation for a measure), I get the following error when I add the measure to a table.

 

Formula:  

previousMonth = PREVIOUSMONTH('xxxxxxxxx xxxxxxxxxx'[Partner Deal Created Date])

 

Screenshot 2021-11-18 191015.png

Is this a limitation of using a Power BI dataset as the source or can this be achieved using a different formula?

 

My end goal is the be able to have a Measure as part of a slicer (which does not seem possible - I cannot add measures to slicers).

 

Thanks in advance!

7 REPLIES 7
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

Could you please share me with your pbix file after removing sensitive data?

 

Best Regards,
Eyelyn Qin

v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

Based on my test

1. Connect to a Power BI dateset, and create [previousmonth] measure.

2. Create visuals on Power BI Desktop and publish the report to service. Both work fine on my side.

 Did you create visuals firstly in Desktop? Is your Power BI Desktop the latest version?

Eyelyn9_0-1637655018554.png

 

3. It's not supported to apply measures to slicer.

4. When connect to a Power BI dateset , the connection mode is Live connection, we could not create calculated columns in this mode.

 

 

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

Anonymous
Not applicable

Hi @v-eqin-msft ,

 

Thanks for writing!  I succeeded to create the measure.  However, I still get the error when trying to add it to a new visual (table) or existing table (visual).  So unfortunately, I cannot even view the measured data (to confirm it is valid or not).

 

Screenshot 2021-11-18 191015.png

 

I created this in Power BI Desktop Version: 2.99.621.0 64-bit (November 2021) - I think the latest.

 

I am new to Power BI.  I am using Live Dataset.  What would the the negative impact if not Live Dataset?

 

Any thoughts on what this error means?

 

Thanks!

amitchandak
Super User
Super User

@Anonymous , if the date column is detected as date the 

new column

month(eomonth([Partner Deal Created Date],-1) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

 
It looks like when I write this query, the column with dates cannot be selected. It seems only columns with number values are allowed. Not sure why. Thanks

@Anonymous , Hope you are creating a new column, not measure. A column should not stop the selection of a column

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

I am creating measures. The option to create new columns or add tables are not there. I think this is because I am using a power bi dataset as my source. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.