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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
nesrine
Frequent Visitor

loop Statement to DAX

Spoiler
 

Hello,

 

i'm new user of Power BI and i need your help!

For my company, i need to know fo each date (weekly date), the number of line( number of application (here is type string)) in a table. And then do a substraction (for exemple here -3 to illustrate). And show the result ( coloun my result) in my dashboard depending on the selecting date. 

I have been thinking a lot, maybe ( loop would work but i don't know how to use loop on DAX. maybe ANOTHER SOLUTION.. ) 

THANK YOU VERY MUCH FOR YOUR HELP. 

 

Capture.PNG 

1 ACCEPTED SOLUTION
petrovnikitamai
Resolver V
Resolver V

new column = countx(filter('tableName';earlier([date])=[date]);[date])-3

try this

View solution in original post

4 REPLIES 4
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @nesrine,

 

Please refer to below measures:

NB rows = CALCULATE(COUNT(Table6[Application]),ALLEXCEPT(Table6,Table6[Date]))

My result = [NB rows]-3 

1.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
petrovnikitamai
Resolver V
Resolver V

new column = countx(filter('tableName';earlier([date])=[date]);[date])-3

try this

Hi @petrovnikitamai 

 

I have 2 table in my Power BI report B-Details and SPResult. SP result table is a stored procedure and will change dynamically with parameters. I want to create a new table from this in which it should filter Name and Country from B-Details and SPResult. Now after filtering this we have a uniquekey in B-Details. Now in the new table for each UniqueKey we have to get all the filtered values from SPResult table. So in the new table UniqueKey key row will be duplicated with as much rows we have in SPResult. Can you help me how to fix this?

petrovnikitamai Thank you very much 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.