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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Possibilitis
Frequent Visitor

Converting Dax from PowerBI Desktop to M langue in the a datamart

Hi folks , 

I need your help. 

 

I have code which was written in DAX (PowerBI Desktop), but I need to convert it in Power Query in PowerBi Services to be used on a datamart. Below is the code : 

 

Parameter1 = GENERATESERIES(0, [Current Period], 1) on the Parameter table

Measure1 = SELECTEDVALUE('Parameter'[Parameter1]) on the Parameter table

 

The problem I have is that , [Current Period] is a measure created in datamart using another table, it is not available in Parameter table . It is not available in Transformation View. This means that I cannot use it to create a calculated field/colums "Parameter1" in the Transformation View. 

I managed to create  Parameter1 = GENERATESERIES(0, [Current Period], 1) as measure in the datamart , but I get an error when I try to reuse it  while I am creating the Measure1 = SELECTEDVALUE('Parameter'[Parameter1]). 

 

I get the following error : 

 

Column 'Parameter1' in table 'Parameter' cannot be found or may not be used in this expression. Alhtought I have created it  as a measure. 

 

I tried to use the following approach and i am getting pretty much the same error : 

 

Measure1 = SELECTEDVALUE(GENERATESERIES(0, [Current Period], 1)). 

 

Question : does anyone knows how  I can achieve this what was wording in DAX in destop and do it in DAX and PowerQuery in PowerBi Services? 

 

Thanks for your help.

2 REPLIES 2
amitchandak
Super User
Super User

@Possibilitis , You use List.Numbers to generate series of numbers

Power Query- List.Numbers: https://youtu.be/7_4V_Om-FEk

 

Selectedvalues only work in a measure, so you have to create a measure

Measure1 = SELECTEDVALUE('Parameter'[Parameter1])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks for replying . I know that because I have used it for another parameter. The issue with this one is that , I cannot create it in powerQuery because it uses  "[Current Period]" as a max  but [Current Period] is a measure  which is not available in PowerQuery. Is there anyways I reuse a measure in powerQuery? That's the issue I am trying to solve.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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