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
Anonymous
Not applicable

Need DAX help

This is an silly issue but really i need help. I am trying to convert below to display records and rank wise but while converting it's throwing error. But it's working fine when i browse the tabular cube and write the query.

evaluate
ADDCOLUMNS(test, "Rank", countrows(FILTER (TEST,[Paid_Amount]>=EARLIER([PAID_AMOUNT]) )
)
)

Ranking = ADDCOLUMNS('Fact Claim',"Rank",COUNTROWS(FILTER('Fact Claim',[Paid Amount]>=[Paid Amount])))
issue.PNG
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi Paid Amount isMeasure in my model.

Paid Amount:=sum('Fact Claim'[Paid Original Amount]). when i am trying to use inside of earlier Paid Amount not listed.

Other way which you are provided i ahve tried same measure but it's throwing me an error.conversa.PNG

 

View solution in original post

8 REPLIES 8
v-gizhi-msft
Community Support
Community Support

Hi,

 

I think in your original formula before converted, the [Paid Amount] is a column but not a measure, so maybe you can try this:

Ranking = 
ADDCOLUMNS (
    'Fact Claim',
    "Rank", COUNTROWS (
        FILTER (
            'Fact Claim',
            'Fact Claim'[Patient Paid Amount]
                >= EARLIER ( 'Fact Claim'[Patient Paid Amount] )
        )
    )
)

The result shows:

3.PNG

See my attached pbix file.

 

Best Regards,

Giotto

Anonymous
Not applicable

Hi Paid Amount isMeasure in my model.

Paid Amount:=sum('Fact Claim'[Paid Original Amount]). when i am trying to use inside of earlier Paid Amount not listed.

Other way which you are provided i ahve tried same measure but it's throwing me an error.conversa.PNG

 

amitchandak
Super User
Super User

@Anonymous , You can use min or max and create an earlier kind of formula in measure. But row context/group by is missing in this

 

Ranking = ADDCOLUMNS('Fact Claim',"Rank",COUNTROWS(FILTER('Fact Claim',[Paid Amount]>=min([Paid Amount]))))

Anonymous
Not applicable

Still getting issue while using min.I think so arithematic functions will not work tabular model source.

issue.PNG

az38
Community Champion
Community Champion

@Anonymous 

your Paid AMount is a measure

try to use SELECTEDVALUE() instead of MIN()


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
Anonymous
Not applicable

Hi, I am trying to use measure in selected value but am not getting measure into the list. is there any other way i can write.

issue.PNG

Pragati11
Super User
Super User

Hi @Anonymous ,

 

The following DAX is missing EARLIER function in the highlighted section:

Ranking = ADDCOLUMNS('Fact Claim',"Rank",COUNTROWS(FILTER('Fact Claim',[Paid Amount]>=[Paid Amount])))

 

Try writing it as:

Ranking = ADDCOLUMNS(

                                           'Fact Claim',"Rank",COUNTROWS(

                                                                                                 FILTER(

                                                                                                            'Fact Claim',[Paid Amount]>=EARLIER([Paid Amount])

                                                                                                            )

                                                                                                )

                                           )

 

If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

 

Thanks,

Pragati

 

 

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Anonymous
Not applicable

Hi, Earlier is used with calucalted columns not with measures so that is the reason am not using earlier.

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.